From nobody Tue Feb 14 22:06:33 2023 X-Original-To: dev-commits-src-main@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 4PGZzs71srz3q47S; Tue, 14 Feb 2023 22:06:33 +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 4PGZzs6S4Qz4Dkf; Tue, 14 Feb 2023 22:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676412393; 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=riXx+Qb5ztdqh2QkfnRgo7rcjMD1Tk1opJwu8tlxBx8=; b=DFf4RLK1+sUaKjDYFi/oNuW7YhkVJusVl8shrq1j0GO7ZqMjN83mKPRyH3SnA30f+NubEr C3L/xyrrVST3YQ1WIpCEwX7Ts9PqRFk9F258t3kLLAM+t6SsKltdOKs/f2it3BfREemU+B tsUnO4DxiTmQqB7zWtWs/YWa01Oxpj3OIehO2qIbacIqZmyISQW4AnIZ/9I98DGHGIWe4+ mGao+mFAmEvCGhlH+g6IhTf0g/162pqisn2JREp4qLIj/Fbwc3k7KcAFQQARMH6DHLHeQG g12KBe65PNaIrJ3lLQUk0QACJQN4TgSe32GeBl206l/MDEjR11escGlHRi3JFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676412393; 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=riXx+Qb5ztdqh2QkfnRgo7rcjMD1Tk1opJwu8tlxBx8=; b=ZppBi+ZRvBW3ku6mC6VFLyuGyObgEFlai9qpPGU4guU8n48RGOILuz1HSBNgJkmeLKcgHi CdYK6Gmnf/8qMB9ppuNWaPuGRa9ZidfjCurmMZyG9n36i3+JIEiIFoSmk6/4lWMNNKkCXv E3LwTelYwUFkcR8FbWHvUWq1sKenUDbK+9iTWQo1U0MSekZspn72I/sXHmnQ+0SjESX/Mo 8ZOVKF6UlabY+VP1yIH3ID13sXhkt5rS1HPRZyvxjvFSd3MhX9LvKdqvIdPZJk9fJXLX3k RkCXhzfhiteHSnvvUNFTtUSN9tTI6hG08Fp5r1vKyXmmQFBIdeKGQnHlyXIhGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676412393; a=rsa-sha256; cv=none; b=RrfuGUErnfwitq8Fi4RdekLmDU3u26M5XEV154QWWbXDH0ORKVGNp2eGi+LSI8IPwd5M4v WCZpIS58E3/wqcCK52IsqAlsQ6qq4UmNJp5Dov8hY83Yvh9O52vhlhcZMQoelOpkedrg6g jyp8bE6uyiE1o8tQKzxaRXfNlgSHTnhZ/TRb9Cvwt+i6VVJRqwrOrEkVrhP+PhBBYY6qb1 xICdHjK1N7kUCyuSUx1nTwpt8JS1NYWfzUAvg6UNFtbUny2VOzYQVponPpZXaUr7rDmKdQ VqzZeFnfw0yhujWWtwWpfld/u9R/KubCEfquLq7trN9PwGmfd1m3Soxx1ADMNA== 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 4PGZzs4J1fz1FbZ; Tue, 14 Feb 2023 22:06:33 +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 31EM6Xdh004085; Tue, 14 Feb 2023 22:06:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31EM6XPx004084; Tue, 14 Feb 2023 22:06:33 GMT (envelope-from git) Date: Tue, 14 Feb 2023 22:06:33 GMT Message-Id: <202302142206.31EM6XPx004084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 836367272917 - main - linuxkpi: Add `synchronize_shrinkers()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83636727291714c235726da987a02c5b1d51bb54 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=83636727291714c235726da987a02c5b1d51bb54 commit 83636727291714c235726da987a02c5b1d51bb54 Author: Jean-Sébastien Pédron AuthorDate: 2023-02-13 20:49:28 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-02-14 22:01:06 +0000 linuxkpi: Add `synchronize_shrinkers()` It takes the lock and release it immediately to make sure no shrinkers are running in parallel. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38565 --- sys/compat/linuxkpi/common/include/linux/shrinker.h | 2 ++ sys/compat/linuxkpi/common/src/linux_shrinker.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/shrinker.h b/sys/compat/linuxkpi/common/include/linux/shrinker.h index 39ea35f0a862..04e96a12c4bd 100644 --- a/sys/compat/linuxkpi/common/include/linux/shrinker.h +++ b/sys/compat/linuxkpi/common/include/linux/shrinker.h @@ -51,8 +51,10 @@ struct shrinker { int linuxkpi_register_shrinker(struct shrinker *s); void linuxkpi_unregister_shrinker(struct shrinker *s); +void linuxkpi_synchronize_shrinkers(void); #define register_shrinker(s) linuxkpi_register_shrinker(s) #define unregister_shrinker(s) linuxkpi_unregister_shrinker(s) +#define synchronize_shrinkers() linuxkpi_synchronize_shrinkers() #endif /* _LINUXKPI_LINUX_SHRINKER_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_shrinker.c b/sys/compat/linuxkpi/common/src/linux_shrinker.c index b48e491a4e2f..227ef3261cb3 100644 --- a/sys/compat/linuxkpi/common/src/linux_shrinker.c +++ b/sys/compat/linuxkpi/common/src/linux_shrinker.c @@ -64,6 +64,14 @@ linuxkpi_unregister_shrinker(struct shrinker *s) sx_xunlock(&sx_shrinker); } +void +linuxkpi_synchronize_shrinkers(void) +{ + + sx_xlock(&sx_shrinker); + sx_xunlock(&sx_shrinker); +} + #define SHRINKER_BATCH 512 static void