From patchwork Tue Apr 4 00:13:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13198931 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 396F5C761AF for ; Tue, 4 Apr 2023 00:14:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF0FC6B0074; Mon, 3 Apr 2023 20:14:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A7B6F900002; Mon, 3 Apr 2023 20:14:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A5F56B0078; Mon, 3 Apr 2023 20:14:01 -0400 (EDT) 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 7AF4C6B0074 for ; Mon, 3 Apr 2023 20:14:01 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 24F5F160D82 for ; Tue, 4 Apr 2023 00:14:01 +0000 (UTC) X-FDA: 80641785882.12.03EBE15 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf29.hostedemail.com (Postfix) with ESMTP id 5680C120012 for ; Tue, 4 Apr 2023 00:13:59 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ERBMFlpw; spf=pass (imf29.hostedemail.com: domain of 3xmsrZAoKCHMpfjipRYdVUXffXcV.TfdcZelo-ddbmRTb.fiX@flex--yosryahmed.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3xmsrZAoKCHMpfjipRYdVUXffXcV.TfdcZelo-ddbmRTb.fiX@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=1680567239; 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=/hxuqZFO5U+CmKAu0Izd1qiRBhW4afUnD0WyfUo4Gcw=; b=tlux+cr7Cbb7VhPScC6rchk4oZLBGAfB86jEh1dlMoDJSS5Hy2XcTW3habtlOMY5bf79Wn E7m8t7++fzlXB8dI56MyRoT7D1YQhg1ESYAyRK7fndJBvMnSjA8YMNmj5/AMCgFRbj3gcj +3pW7x3/WGCBgE2gTzJHDdcEUFmRxKw= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ERBMFlpw; spf=pass (imf29.hostedemail.com: domain of 3xmsrZAoKCHMpfjipRYdVUXffXcV.TfdcZelo-ddbmRTb.fiX@flex--yosryahmed.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3xmsrZAoKCHMpfjipRYdVUXffXcV.TfdcZelo-ddbmRTb.fiX@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680567239; a=rsa-sha256; cv=none; b=Q7A9gS3fqSLSxKcTbQrxQxPsqy0VPo/klXes6OnxS1LeQ9NMcXqS4id85PaFYm6q8fz/WI 6GmvQvovZiJhlhJLLGCjEiLmbLIRl3yo8LuDzkQeLV4ki1Fn6b9zkTCUYgpMViJVjjZUAK DaJVtS0FMFMKVtxTD7WTuzfRILrqm9A= Received: by mail-pl1-f201.google.com with SMTP id w14-20020a170902e88e00b001a238a5946cso15856159plg.11 for ; Mon, 03 Apr 2023 17:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680567238; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/hxuqZFO5U+CmKAu0Izd1qiRBhW4afUnD0WyfUo4Gcw=; b=ERBMFlpwQ+/e/a/Z3AL8E+p3U9MNbkZrsz1HL/MZqvfsps00VtVZYbkySPDVq2/6aR LHVdBQe3ElTtHckYtN+0h+FDNuiI47HZzvKorWDJwFV06A2ZOZ9rTLgMNb03YVp2wZvD PgyPdh7s9QF5a+LrPpjkbUaqX5VHdnehZzbSO8EQsnkGFGX9ApbhWI2WH3GTZIdOCnMl aWLwqKHsahq90y7bzc7mLyA1MCyJjLXiPgYUQBEdJC8xf/8EamW1fLH2Ww2pGZUCTg1p jUEPpHXUbx3wFMtNPW+KmYfxXVLvMYfkOtlZrUyDZokuwj17Ht/6/tV/rlF0tPwOfpWA Gsag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680567238; 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=/hxuqZFO5U+CmKAu0Izd1qiRBhW4afUnD0WyfUo4Gcw=; b=dKRN2tCsq9VZrEsOE+fYx5XHT7zTG/xHHIHeaoI2YuNBZ9wEvylxqDwhn9HAJqnsee DDhKabpd2hb7ffOqWEZO4Tbu/BciUh03gOC+KBzoYDrm0tDd7C3J8J+kx5h5ut/ENAwI eNuE7nlIna9PQw9eTiZF8jhQcVMAZGtMjgzrze841J0h0p9GFmCfiAAjBkSchGG6rnJU /DOztN1+rMcdFbPyNYY5RsMdi4TN4RTaow0mOc8adMO0vvrRTMuvtXpSeGwl9yLiU9w/ p18lrWBPpVlxMlWj+qYUx2qgIw947LBqOjdDBs666S5KbozT73MohXUFKz/9HyCtvUw+ OPSQ== X-Gm-Message-State: AAQBX9e2QGe9MKbjd0XQUfWSCkZbuaYA4i8uEfRk/ihpmCgbBsNVnYFe kEDBcm/QutbXafZ0+gbFg7ymoousAqQYEBFb X-Google-Smtp-Source: AKy350Z+Sm8hAQJcQhRAP+xzVs9NeoT30dH7npmf11D1Z/F0xl2wPw5f56Q84WDvH4pUeUa2sdKUL4OGwZiD1m0K X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a05:6a00:23cd:b0:625:5949:6dc0 with SMTP id g13-20020a056a0023cd00b0062559496dc0mr232232pfc.4.1680567238017; Mon, 03 Apr 2023 17:13:58 -0700 (PDT) Date: Tue, 4 Apr 2023 00:13:51 +0000 In-Reply-To: <20230404001353.468224-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230404001353.468224-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog Message-ID: <20230404001353.468224-2-yosryahmed@google.com> Subject: [PATCH v4 1/3] mm: vmscan: move set_task_reclaim_state() after global_reclaim() From: Yosry Ahmed To: Andrew Morton , 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 , Dave Chinner 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: rhsdgg1twoagrspzu35sncnmj9jtx1ac X-Rspam-User: X-Rspamd-Queue-Id: 5680C120012 X-Rspamd-Server: rspam06 X-HE-Tag: 1680567239-435398 X-HE-Meta: U2FsdGVkX1+OysQHnGfsXJv3smkS+dYsMM+W17AJW8vFUlhXUuxt+EMP4iqzBjatCEW2INGNYH+tnoVQemjDsTGPQnxXWUc0gGfezWA0Ev7n9uSjNx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fVYx9A00H2s0y9LolRGi8ycI1/CCGJYWSyUrC+TWxptyM1aVoYYOSgfU9T6KD1162pSIfQ8MLjeaoNqZLRN2rZVQsWBu/woxKo3ljA4kqkCvq2jZZb0kejgPGF2b+ZsFBlwWbil32p2zXkl6wYIg5my2S3qy3RsnA+7lLqswXlsRmdl05EQdgIhDBaUkCGnQc9FWNbnfxyMgLkjZP2FM4uzrTLxJK2BhgYxjKmX8UvEi1luflgqYESjqah1wIxj0A53zHBSEug0NfPS6C7kGTZ9r6RKrJxa7Ibzqr6Oe6A01GAq/IbY/6osyjkJAWi9lnd/AqaN+7H6uYldDCoRsYoIBckAEcsmQuANWYrbMmINHy2bYmZpLR2vLyhXY4e0tdYmQ6fMQ9SR4f4zEJ6AomBxJxPDMUmDKrwRAipWmB7XXio22au6ehB0fKQ9Ae9ha5X83j5qe4Pf0oZ4iFKaH60hw63a45k4pOgjAVpSKJlM6qbjgfXngGn8ELn3WRa4A0uewXd39ZS7fIEeLYzGcRvmXchlFo2Gtr8j0Q/MOx/8fyRQVpwEZR4uyhNQ= 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 global_reclaim() is defined. We are about to add some more helpers that operate on reclaim_state, and will need to use global_reclaim(). Move set_task_reclaim_state() after the #ifdef CONFIG_MEMCG block containing the definition of global_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 9c1c5e8b24b8f..fef7d1c0f82b2 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) {