From patchwork Thu Mar 9 09:31:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13167118 Return-Path: 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 9AF8EC6FD1C for ; Thu, 9 Mar 2023 09:31:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C8F8280002; Thu, 9 Mar 2023 04:31:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3784F6B0078; Thu, 9 Mar 2023 04:31:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24068280002; Thu, 9 Mar 2023 04:31:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 15B846B0075 for ; Thu, 9 Mar 2023 04:31:32 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 93355403E0 for ; Thu, 9 Mar 2023 09:31:31 +0000 (UTC) X-FDA: 80548841982.07.8E2119B Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by imf09.hostedemail.com (Postfix) with ESMTP id BC877140013 for ; Thu, 9 Mar 2023 09:31:29 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=KzU6h4ue; spf=pass (imf09.hostedemail.com: domain of 3cKcJZAoKCA0B154Bnuzrqt11tyr.p1zyv07A-zzx8npx.14t@flex--yosryahmed.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=3cKcJZAoKCA0B154Bnuzrqt11tyr.p1zyv07A-zzx8npx.14t@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678354289; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=o6dgxagOpBb1myYnk/1Y2AGrRWWDZLYTueWoLu8qIY4=; b=K8ytITM9SZ4CuJmhpi1wjgQOjQQd1LSHDXfCD0hgVRAOZ2LLu2DlZeyU8pd600gCoZVE9C GGH5uFezj24zbQngLzW2LUelaXRGG1QbCrZP9xMt/Qs08d6/m+rdyJJqBnaxqqJVE2W5Uw 8klRnb3YaO5JAIwk04odsIe3NT8bIdE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=KzU6h4ue; spf=pass (imf09.hostedemail.com: domain of 3cKcJZAoKCA0B154Bnuzrqt11tyr.p1zyv07A-zzx8npx.14t@flex--yosryahmed.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=3cKcJZAoKCA0B154Bnuzrqt11tyr.p1zyv07A-zzx8npx.14t@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678354289; a=rsa-sha256; cv=none; b=6VU0cUvDp0+h41x6RlgsmcWMDG9mjeNNDRPk/2vBgLmnbQEFED28eYC4ysbFDNCknluSoV GHoicfz8y79e/aGdhEZ0F7pEEOrSKPPcZIAkccHrMLdQq8jr3vhIxC1+ixoqEr7R52AiCz 3KMCCi/CiJzaGbBlb81y1Ap/jvWQrh0= Received: by mail-pg1-f202.google.com with SMTP id d22-20020a63d716000000b00502e3fb8ff3so452279pgg.10 for ; Thu, 09 Mar 2023 01:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1678354288; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=o6dgxagOpBb1myYnk/1Y2AGrRWWDZLYTueWoLu8qIY4=; b=KzU6h4ueyt1nc3fHTw62ynzTN6cM5FPoDfMBmAqJ1Wwes61zVej5BOhlYyPncxm4Zm nkjKeBNIQMZU0E9YJO2405czXqReQIP71dpM6JRcIVBwGfbOfnDAO+93r67dHWvV1VcL zONddPvKo2/hWkzUIRnhDO3Zqp+7yh7T+acFffATa66sYzOvTr15BMFihxW3t2a2tMq/ 8Ig75rYkpQRqgddwtZBlA3k3y0eMCsf3xzOYsCI2yvjWMp0avrLAbOSW5a+OH2FI5iL+ ETd/0TFbN+DnBMOE/8xtP1qGx1HOTcBW/q+JbvhFqWJVi18NNllY9Hag5hM4SObpgkS6 mKfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678354288; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=o6dgxagOpBb1myYnk/1Y2AGrRWWDZLYTueWoLu8qIY4=; b=nFlrjvHaHEgblbHpyNmbNQsUjKJP4AiDQhiyFPO1LZxtgVSHZtQil0tLCMKsRAHZzt 2+aXdYGIf8I36g4f5AkEwIeUuSSYveY/JtXkTon7wXO4Yv2zxNJClxw6H7Z9nsVavQCe plVolAkY5Ye3Odm6SbeyAH35hSq9LB+QXXZLUGZA2YqaZojWfcX5Q0zuR7GGPFk+dnGM aoZN+13hVSlApVherQcnHyHY4DZpPjDINSGTPpMNd1GDX6KaIrPDa2PvbBcfP1s81Amg P/OPmHnNVP5F7eZ1E9n3LqHIk7gCyUR5I89NKYrSbozsq+qsI7Z9hf+MEDG2pX9QScsW YeMg== X-Gm-Message-State: AO0yUKVgsgKKgPbRcP2acqEsLmekaYIHZI6n7n0xu+3JrrUo22WuLEBZ +5M2e7D+FIv2vwWKn4iAlGvxR8+hIokfkHWW X-Google-Smtp-Source: AK7set82CEBSuqo8FpS3nsNPKqDoN9u1SA11kEpTwZaYFka9KSS8D9zMVtgu+8uzsp90VdIxYuFl/oAa7auTdfM+ X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a63:5508:0:b0:502:fd71:d58c with SMTP id j8-20020a635508000000b00502fd71d58cmr7728137pgb.9.1678354288447; Thu, 09 Mar 2023 01:31:28 -0800 (PST) Date: Thu, 9 Mar 2023 09:31:07 +0000 In-Reply-To: <20230309093109.3039327-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230309093109.3039327-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog Message-ID: <20230309093109.3039327-2-yosryahmed@google.com> Subject: [PATCH v2 1/3] mm: vmscan: move set_task_reclaim_state() after cgroup_reclaim() From: Yosry Ahmed To: Alexander Viro , "Darrick J. Wong" , Christoph Lameter , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, "Matthew Wilcox (Oracle)" , Miaohe Lin , David Hildenbrand , Johannes Weiner , Peter Xu , NeilBrown , Shakeel Butt , Michal Hocko , Yu Zhao Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, Yosry Ahmed X-Stat-Signature: rgeeqd4uipdm8ardn9ubjtaohuxtgydb X-Rspam-User: X-Rspamd-Queue-Id: BC877140013 X-Rspamd-Server: rspam06 X-HE-Tag: 1678354289-109279 X-HE-Meta: U2FsdGVkX1+c0KiYMniyXRQ7nUeay8BbAfofifw3iTDhV8kUF7kmkiWvh7a8opVA3valABRt8NgKgnvd7q8WDPEvLsYFTaMMu4OTLyFHTcPikp5VAwFk6O+4yyWrxHY6ygLcuGWGC8nWRGx+/yIt32mgmRdxaIL1Ka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ZKAWXqat1Pqd6Rj+he4ZRgr5CZXOK53JHji1hyG08W1wlIurBCw1CBh/WtrZdUfOevA//XjPdrhSXmeGm8pdkEUuFmh3IJwEXrQfwr71DW20+mWjFV70jJc8GOQGRyiyrUU/4vhCwIgk9DbrchD1XdN25ZVSDI5EAyJrUjFH0BPBGCSVq61HaGO8u2FJNM7teQURWCWdK3+DXs8XWpWvEpkRG1CrMAEzG0p3uFHCwajlNIYc+XEDS0XOzaAHEr20yxzP7eEu8cezFdPb/oiRGuRsZUo27br7cJlQqP8gakelBPpfR4Dd15YkKp2DKrQ9xOZ8ajE1ivJYi7VFRAQLCXQ0l1eW94V3NPh3+P2kOhaP6RY0if4VvF0FG0eiCK9ud6ziZknErc6q5WxkXFUi6O/cp49JUp1IdIDz4dTaDmqRyilaSX7/Q5iFcFfAx2c7/3eQyysDmaw+ZekiH6u4rZdgcqjpC3Ezu+Z7dBnnRXpP62HpeaRv4qyPoCBjQebS3UUd0b4= 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: set_task_reclaim_state() is currently defined in mm/vmscan.c above an #ifdef CONFIG_MEMCG block where cgroup_reclaim() is defined. We are about to add some more helpers that operate on reclaim_state, and will need to use cgroup_reclaim(). Move set_task_reclaim_state() after the #ifdef CONFIG_MEMCG block containing the definition of cgroup_reclaim() to keep helpers operating on reclaim_state together. Signed-off-by: Yosry Ahmed --- mm/vmscan.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 9c1c5e8b24b8..fef7d1c0f82b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -188,18 +188,6 @@ struct scan_control { */ int vm_swappiness = 60; -static void set_task_reclaim_state(struct task_struct *task, - struct reclaim_state *rs) -{ - /* Check for an overwrite */ - WARN_ON_ONCE(rs && task->reclaim_state); - - /* Check for the nulling of an already-nulled member */ - WARN_ON_ONCE(!rs && !task->reclaim_state); - - task->reclaim_state = rs; -} - LIST_HEAD(shrinker_list); DECLARE_RWSEM(shrinker_rwsem); @@ -511,6 +499,18 @@ static bool writeback_throttling_sane(struct scan_control *sc) } #endif +static void set_task_reclaim_state(struct task_struct *task, + struct reclaim_state *rs) +{ + /* Check for an overwrite */ + WARN_ON_ONCE(rs && task->reclaim_state); + + /* Check for the nulling of an already-nulled member */ + WARN_ON_ONCE(!rs && !task->reclaim_state); + + task->reclaim_state = rs; +} + static long xchg_nr_deferred(struct shrinker *shrinker, struct shrink_control *sc) {