From nobody Wed Jun 01 21:51:46 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 073861B5C768; Wed, 1 Jun 2022 21:51:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LD2st63b8z4qvB; Wed, 1 Jun 2022 21:51:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654120306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i55YIKFOKwFEb1KJ9xkbYwp3i0GrXT5Qrcfcixchln8=; b=o1lVxtN9DpTmquHKhlkrZZ9zIxrIFWOGnjNmU6qbmkLJt2/+yquzTY8C83qmFXZZAHYOjc tyWaea3SnyfNcKhr0rYwkt8LKY/ump2DO0PER5hliC7ff4ntDWRNbU/qQtu2wVe4bORdgD HwYLRFrYHdY+pB/P8fwWeEsR9Y3qKizZpOMgKoizZN08CQwBudD47bapnSx56mvj8ZFG1l FzTPNVa8WO8Joizx1mCyuLX/5TGV1tRK/6QOth5BWGJd9ppe5N0kF657HhR1iGXArnhQzC 9aqjgBg8tSLYBs2Kyo0VN6v5UnmEY2TrWy/nYw1XtZV/lAeri2ka5j+h/3XOzA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A1153E8; Wed, 1 Jun 2022 21:51:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 251LpkHM042751; Wed, 1 Jun 2022 21:51:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 251LpkWP042750; Wed, 1 Jun 2022 21:51:46 GMT (envelope-from git) Date: Wed, 1 Jun 2022 21:51:46 GMT Message-Id: <202206012151.251LpkWP042750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 6f8b356c0b17 - stable/13 - LinuxKPI: Convert lkpi-shrinker lock to sx. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6f8b356c0b178897658f6714e5c6c6592fc6a116 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654120306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i55YIKFOKwFEb1KJ9xkbYwp3i0GrXT5Qrcfcixchln8=; b=pF8eR9PX2XDypys2HZuYPfZA2DjJL+ulTMs9jXSGU8P0JsJwFxj+YS/bp7aD+QFj1x/ca0 GwKTd1ezzLNGvNn3aN2P//uxZzDyzZGFKc8myETlXX+rcJmynryoCRgcICLrqD274/yH3u N6Y2L6va+1rQrq1Eqr5ej+tdwLBlB+4yeSDyeeAuLCvPeKc+6cN9WRnSKpbqOuAMYf7e2A wyC8DxgzvLnJH6uNE/CdkawC5fCCWP8IKC8QtdY/eLJbglq2oMn+FwsrISRqUliYXpSOuk AZgfgGYvud/lub9LcOFbfTKTBPU3XQ7IXfjIwOvN+vw5fIUTG94zWVVKALdFWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654120306; a=rsa-sha256; cv=none; b=WGLP1C3R4iEfdjswDthrfAm7TSyi4i/gUAS61UFIVLbW/9uUXRWMT0cIBO2O4Fp1ryiQ+I NoVVj6RC4vAXffVsdgRnh0L7xv5CZXIZfZwyA+SD7rE6X7yQ7ZMfLSNNaNx4bD0GavFfvm RlukaCUPA2/k9We13WKHUiSDgpIQXDbQHwsZkTMmD8QNRDq8OC/Sdq5dunJFP5yYq01l1Y BJXGpfWHWMZm0fplBOZIWaLlY0xsOofnUIZ9s1tPoGzVjANO4BDs2Z8JNBYWGsVjXriJcZ aEr9CakV4pl23ujTRdGgJlDTKIQKizhQoxU7sBfEIy83TN7seTlpLaH1WpVmFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=6f8b356c0b178897658f6714e5c6c6592fc6a116 commit 6f8b356c0b178897658f6714e5c6c6592fc6a116 Author: Vladimir Kondratyev AuthorDate: 2022-05-17 12:10:20 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-06-01 21:50:13 +0000 LinuxKPI: Convert lkpi-shrinker lock to sx. This fixes "might_sleep() with the following non-sleepable locks held: exclusive sleep mutex lkpi-shrinker" warnings. MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D35047 (cherry picked from commit 29d5f0c148059806d8f0d9e55acdd072994fa450) --- sys/compat/linuxkpi/common/src/linux_shrinker.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_shrinker.c b/sys/compat/linuxkpi/common/src/linux_shrinker.c index b66316c22013..b48e491a4e2f 100644 --- a/sys/compat/linuxkpi/common/src/linux_shrinker.c +++ b/sys/compat/linuxkpi/common/src/linux_shrinker.c @@ -34,13 +34,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include TAILQ_HEAD(, shrinker) lkpi_shrinkers = TAILQ_HEAD_INITIALIZER(lkpi_shrinkers); -static struct mtx mtx_shrinker; +static struct sx sx_shrinker; int linuxkpi_register_shrinker(struct shrinker *s) @@ -49,9 +49,9 @@ linuxkpi_register_shrinker(struct shrinker *s) KASSERT(s != NULL, ("NULL shrinker")); KASSERT(s->count_objects != NULL, ("NULL shrinker")); KASSERT(s->scan_objects != NULL, ("NULL shrinker")); - mtx_lock(&mtx_shrinker); + sx_xlock(&sx_shrinker); TAILQ_INSERT_TAIL(&lkpi_shrinkers, s, next); - mtx_unlock(&mtx_shrinker); + sx_xunlock(&sx_shrinker); return (0); } @@ -59,9 +59,9 @@ void linuxkpi_unregister_shrinker(struct shrinker *s) { - mtx_lock(&mtx_shrinker); + sx_xlock(&sx_shrinker); TAILQ_REMOVE(&lkpi_shrinkers, s, next); - mtx_unlock(&mtx_shrinker); + sx_xunlock(&sx_shrinker); } #define SHRINKER_BATCH 512 @@ -94,12 +94,11 @@ linuxkpi_vm_lowmem(void *arg __unused) { struct shrinker *s; - linux_set_current(curthread); - mtx_lock(&mtx_shrinker); + sx_xlock(&sx_shrinker); TAILQ_FOREACH(s, &lkpi_shrinkers, next) { shrinker_shrink(s); } - mtx_unlock(&mtx_shrinker); + sx_xunlock(&sx_shrinker); } static eventhandler_tag lowmem_tag; @@ -108,7 +107,7 @@ static void linuxkpi_sysinit_shrinker(void *arg __unused) { - mtx_init(&mtx_shrinker, "lkpi-shrinker", NULL, MTX_DEF); + sx_init(&sx_shrinker, "lkpi-shrinker"); lowmem_tag = EVENTHANDLER_REGISTER(vm_lowmem, linuxkpi_vm_lowmem, NULL, EVENTHANDLER_PRI_FIRST); } @@ -117,7 +116,7 @@ static void linuxkpi_sysuninit_shrinker(void *arg __unused) { - mtx_destroy(&mtx_shrinker); + sx_destroy(&sx_shrinker); EVENTHANDLER_DEREGISTER(vm_lowmem, lowmem_tag); }