Message ID | 20230226144655.79778-8-zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24692C64ED6 for <linux-mm@archiver.kernel.org>; Sun, 26 Feb 2023 14:48:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8EB76B007E; Sun, 26 Feb 2023 09:48:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B3E496B0080; Sun, 26 Feb 2023 09:48:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A07836B0081; Sun, 26 Feb 2023 09:48:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 92B836B007E for <linux-mm@kvack.org>; Sun, 26 Feb 2023 09:48:53 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 76DEA1C5D41 for <linux-mm@kvack.org>; Sun, 26 Feb 2023 14:48:53 +0000 (UTC) X-FDA: 80509724946.11.3A56D93 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf15.hostedemail.com (Postfix) with ESMTP id BA4F9A0010 for <linux-mm@kvack.org>; Sun, 26 Feb 2023 14:48:51 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=RLNAX82e; spf=pass (imf15.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677422931; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rPbK2mA8SftO30bweBpSZUhXCxYptD2QUCquMlUkzZQ=; b=bF0Y1KO1gaPuODxxmAQpZkkphBWVScYHqRCGohn79em1BT4oBcaxFSeXub+II1csjnPDOZ dlW/v2yDOilFWHFJihEEaVpI1sdjJwKjLouhIypMNDBoV9WVeuQFLwW/w55+RK0wE+XlZw GhXPevff0OmZeCOqpm/1M1PV1QSElv8= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=RLNAX82e; spf=pass (imf15.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677422931; a=rsa-sha256; cv=none; b=h7dhUxmmGlh9XHbTxpKekzIdJeF0eMBu5R6YEpoRSoINkRkOZc7CbQB4GTnLuknoTdH82i qjKmLzLZu6m9U3CdlBW3StgGMnnEXOgPReGjFsHFefQNuw9FkxB0jXQLw+5Nyq/EnxCqLS LqEBnxlGpRwJEzN/0qBiEw2tg/mdzQE= Received: by mail-pl1-f175.google.com with SMTP id i5so2515827pla.2 for <linux-mm@kvack.org>; Sun, 26 Feb 2023 06:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rPbK2mA8SftO30bweBpSZUhXCxYptD2QUCquMlUkzZQ=; b=RLNAX82ej6WiOp+gJxxrYUevqQBzdDGYpvRp2WltPYHzsFagaq47ozL06y+Hy6OgmK JK9iGaHN7dJvbFey7hQXB7aig8jRb8Fzh2ihtgS4KPi3JJgVeer/QP403MbnYAJfXhak bYN0OJJ/krh591ZGhC6ZmW4Bo9d/0ELhp3VjgtJ7eyFa0hScQMuwE81nRfrktkjFE6Os OjbYs65uBBhgwi4YlDp3YuXDzBBPVqJDlkDh/2welq1ly/HLAfshGinj1f1s9zkkezz/ 2xhknARP+taXDeqDm4xAjtZ8aw0C7dGDxIicSpRhb2gQC9so4gEZ84pp+H7E0riZtKLc Tpsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rPbK2mA8SftO30bweBpSZUhXCxYptD2QUCquMlUkzZQ=; b=m/TByve51pX6VvSmkFj8ml4a75wZKvJMnTrFJOUvgHjUZDzloAysPPnHtdeBug5BLb qQixXApGniRfvq+Dundj0dFK5adjvXEYJnJbpq46+jzSEdw65xgK1QXaZ3w8ynvp+SNc GJeAuYTvtYBN6Xa72i0mHj8z852jpOxkjwKxb7xCnqyIzlCKMk81pWxSFMbGWXaDrM/p UNPFlcQovI0vqdP3dGePeuUAD5jDsEAD27PgA/Dg8dgUi1tKfo132f7XREN2qILn6U07 e3HWlbHE2j2+u/dd3ZlHdfR+lIL82/Iiyw+L2UB/c9kCTOSxQ11WFr3ZxCEmOMnwBRJz eDKA== X-Gm-Message-State: AO0yUKXhIU97m+oloWRpLoLue13wlbVSonDV1zhYK45G+8h2V4o94tUu Mg8QAC4q5slNRNPi7U0teXgZCw== X-Google-Smtp-Source: AK7set8jSrtu5jvJSft27Jtxn5UB2T4NTHUh1NNGGVH4kZw+rpTeROnHO4aYE0DylXNd7RBZ0PVGQw== X-Received: by 2002:a17:902:d4c8:b0:19a:7217:32af with SMTP id o8-20020a170902d4c800b0019a721732afmr23249925plg.5.1677422930708; Sun, 26 Feb 2023 06:48:50 -0800 (PST) Received: from localhost.localdomain ([139.177.225.248]) by smtp.gmail.com with ESMTPSA id y20-20020a170902ed5400b0019c2cf12d15sm2755589plb.116.2023.02.26.06.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 06:48:50 -0800 (PST) From: Qi Zheng <zhengqi.arch@bytedance.com> To: akpm@linux-foundation.org, tkhai@ya.ru, hannes@cmpxchg.org, shakeelb@google.com, mhocko@kernel.org, roman.gushchin@linux.dev, muchun.song@linux.dev, david@redhat.com, shy828301@gmail.com Cc: sultan@kerneltoast.com, dave@stgolabs.net, penguin-kernel@I-love.SAKURA.ne.jp, paulmck@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com> Subject: [PATCH v3 7/8] mm: vmscan: remove shrinker_rwsem from synchronize_shrinkers() Date: Sun, 26 Feb 2023 22:46:54 +0800 Message-Id: <20230226144655.79778-8-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230226144655.79778-1-zhengqi.arch@bytedance.com> References: <20230226144655.79778-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 93ob46a3fpmntoq7ik8h3t5tem861hkh X-Rspamd-Queue-Id: BA4F9A0010 X-HE-Tag: 1677422931-13535 X-HE-Meta: U2FsdGVkX1+WxauKIwAzELU0vEeUfse2cHf9dy4GiQxuU1O4yIDDBLRJZh0wiNT/0yJwZLAbl/9GuEyJOTE0bS3vXWM+SG1z0fE4gJ0UcpBbgXQCWbM809Mybxq5Ma6jnoDS57EIelFepbXX79a1DoSLfxBSzscnN1rPYsWQkeSqbmVuynGL2y/W0osJMbWXKsT2cimbKfTxN4K1zOEk6P4RnSh2+bO7b1WUOosDJTo9dmZwvVO3nq07hTCoKhiwHCowTRBjD0XyMBm6WpFSd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RGaXn5Q9bXk8Hki1zi0XjvkO81l+rVkF4sYVJrZv+AFDsqqndrKRobVbbH71/NAFmTNRcSh28o7vkpI0KJ2Hqo06Ag/XnNAk8JtVv2pcfw+WsEO9GijxFPOwisKLn X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
make slab shrink lockless
|
expand
|
diff --git a/mm/vmscan.c b/mm/vmscan.c index 16ff64813175..2d71fd565c78 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -796,15 +796,11 @@ EXPORT_SYMBOL(unregister_shrinker); /** * synchronize_shrinkers - Wait for all running shrinkers to complete. * - * This is equivalent to calling unregister_shrink() and register_shrinker(), - * but atomically and with less overhead. This is useful to guarantee that all - * shrinker invocations have seen an update, before freeing memory, similar to - * rcu. + * This is useful to guarantee that all shrinker invocations have seen an + * update, before freeing memory. */ void synchronize_shrinkers(void) { - down_write(&shrinker_rwsem); - up_write(&shrinker_rwsem); atomic_inc(&shrinker_srcu_generation); synchronize_srcu(&shrinker_srcu); }
Now there are no readers of shrinker_rwsem, so synchronize_shrinkers() does not need to hold the writer of shrinker_rwsem to wait for all running shinkers to complete, synchronize_srcu() is enough. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- mm/vmscan.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)