From patchwork Thu Apr 13 10:40:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13210092 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 C397CC77B6E for ; Thu, 13 Apr 2023 10:40:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5690D900003; Thu, 13 Apr 2023 06:40:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EFD46B0075; Thu, 13 Apr 2023 06:40:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4075F900003; Thu, 13 Apr 2023 06:40:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 281E16B0074 for ; Thu, 13 Apr 2023 06:40:44 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E00BFC02FE for ; Thu, 13 Apr 2023 10:40:43 +0000 (UTC) X-FDA: 80676024366.08.246ECEA Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf01.hostedemail.com (Postfix) with ESMTP id C1BC540024 for ; Thu, 13 Apr 2023 10:40:41 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=G81CdUEm; spf=pass (imf01.hostedemail.com: domain of 3KNw3ZAoKCOchXbahJQVNMPXXPUN.LXVURWdg-VVTeJLT.XaP@flex--yosryahmed.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3KNw3ZAoKCOchXbahJQVNMPXXPUN.LXVURWdg-VVTeJLT.XaP@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=1681382441; 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=I6Nt0ZH454lLp6ex7hg7kbI+ex/azfnI8thXAXjWVq8=; b=hkwAj5XGZ+Tki2hLFPXbWwPxP894ne7AhYfk0I1jeiHWKn2mDzTuiPsIC5sH3kETx1/ZsI IyX8jyTW6Q/LgcVOwuwURLRd14RF4O5KkkxiwGQgmBx52m3bFeUEqwIx2Jk0hHXxyzt6so WlA0GdbKPoMNgvWIn+Otd7CDNG2yOrY= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=G81CdUEm; spf=pass (imf01.hostedemail.com: domain of 3KNw3ZAoKCOchXbahJQVNMPXXPUN.LXVURWdg-VVTeJLT.XaP@flex--yosryahmed.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3KNw3ZAoKCOchXbahJQVNMPXXPUN.LXVURWdg-VVTeJLT.XaP@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681382441; a=rsa-sha256; cv=none; b=W3ov+KM9b4YQFex88qjtYCGdCj7sTrS21f9Vegtj20hJ7/eFLXcK3ZaUZImUShIA+ga1vE 3NTUCanaYK2o4jeRuEY27MUs2zGe1CfioFEV3dSoH1JmxvJ6CYKItDevuUQyhctqekj0Cb rzsoVKzZKPyykXLp87FrNA9cvUSKJmI= Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-6323e92b084so1022499b3a.1 for ; Thu, 13 Apr 2023 03:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681382440; x=1683974440; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=I6Nt0ZH454lLp6ex7hg7kbI+ex/azfnI8thXAXjWVq8=; b=G81CdUEmMWAR7s/uUh1o00+dki8yY8e8KOGduTMJ10Ih63YAx82qvcDq20SAZSx+g/ ueZ3Msj52pKD1lqBImwulf/tYkqr/iT+UOeW4fd3KBZv547W+MwD6xwGD67DaW0HpcOa cz9n6Ru3its9gZbaaSThe+VV0hYHOvVD9yp2j0yltd9IKliEUrjXqAr+OK7m03l2qytF xr+P3ML7/b+lezaU3DwMQukf+O+TPg5UG2i07gjQlaxwJnTBDRcJhvP64M/wiFfrpZzz h7ozlZBA7r8DTpqJhi25AoIblQhs+3bOV3uTp+JguZijEY3iI74Y975Ed/lYiOS4TnGE iVnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681382440; x=1683974440; 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=I6Nt0ZH454lLp6ex7hg7kbI+ex/azfnI8thXAXjWVq8=; b=So5UM5kPz+tBFxswa5oI1l7v8Fw3aw/LOjwhY3wvhoJglasUQXwoEXSj72Z2cclL2r Q9aPWqFAVzHineRegcGPSTMo7Z7uWIjgt22Ky3PApaI8c0EO4nj9b+UCICPK6hbAE9H7 YZSb5z1aJMDSZmKPzHb4itBRJBJsUV1360Ke+3GGqtQbn1eWXCz9Ojw3qFFrLxCiwuB2 NOTjXEvDYhbjb3fJGNrTjRu23HGWmv0d8NgdSt9o9PYzIoHrwoOTwmzNP35Q9NXFj199 W4ZR7wYXpnelErkCMBaIXf0LK90A4HVfX2CUwpUvq5qhWnGveC0LILEVCyp59LDICr8N Mtjw== X-Gm-Message-State: AAQBX9dhSkji7OHw9C2UQo2uZJGezCdOgT8NZ2Uf0nHkZ+6U6oULxyZy vc21YuXKyyYaWbf7gEwNgpEz7TP4+UX6mrih X-Google-Smtp-Source: AKy350b4iSx5ozD7gi39VrWatA78FUtgnIqT2lDjsg7piXFtlDqLoC4lH3GhIMzW/GNCYSdmkQiW7wqZ38a9M/36 X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a05:6a00:2e1d:b0:63b:234e:d641 with SMTP id fc29-20020a056a002e1d00b0063b234ed641mr975833pfb.4.1681382440554; Thu, 13 Apr 2023 03:40:40 -0700 (PDT) Date: Thu, 13 Apr 2023 10:40:33 +0000 In-Reply-To: <20230413104034.1086717-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230413104034.1086717-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230413104034.1086717-3-yosryahmed@google.com> Subject: [PATCH v6 2/3] mm: vmscan: move set_task_reclaim_state() near flush_reclaim_state() 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 , Tim Chen Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, Yosry Ahmed X-Rspamd-Queue-Id: C1BC540024 X-Stat-Signature: u7zdr6pehq5i7xgxfjspgqy3mmszb8sa X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1681382441-56822 X-HE-Meta: U2FsdGVkX1/aF52Ru/SB48G9dxS22BACr6DZUS6sDuRmMoF3aTNpQF1ObgWobx6D3r77/lLf80xXdrUvOaGvZSBwX2MXfBfJqysITJsgoEdtZoFr3ZGSWCv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jlbPF2yZtf441QDdA8FOAX1OVNJIZ6jC1gAHw0RgGfDHH3cflKjI07BjA/Y/V1ITRK5EYjo9wqpNYYHITA7LsbvzX4ou8BLS51poPUxmaseQ5VuddIfh6/EFm/qsvuU70Hk14zY3alJ+6EeUgeaXJPhVxJzaYh252KYwXqijHXqoLPGRolMz1mYUwMyCYBkjrOEkqCypBiyoN1YcRtrvxUsTdnFHy4ypOllgFwOB1o9zaPHGtJFLGxNuXhx1VzXu2593zaJNYwmj0HFpg0x3Z5fz2aQaPtRiRU4xUIShJaLN4MFUdP7XdwFj+g6qe3R3Ssdii3hcAAFZPTCJDOwBFeVt27njXzH+yCTZxRfuVpwKmNVYUAd9DwmZsDau+SjwA97lGPUhK+gD+dG1MSJPDaVjEY5/UnEX8gO72uVGQpUX5iUvktDrdlMzqmlwEiFp6OgTXTx6qsZWhv5g+MyAJpYrhFjxmQrBvjNmQhOjUD6MQTBW2MJJq8ofF8dGU7R/zah0fveBAGJ1mFbbKvUV9zU9/gqDcFlE1mnsoFytNViQqzk6RGVBAYGHzn9Q= 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: Move set_task_reclaim_state() near flush_reclaim_state() so that all helpers manipulating reclaim_state are in close proximity. Signed-off-by: Yosry Ahmed Acked-by: Michal Hocko --- mm/vmscan.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index be657832be48..cb7d5a17c2b2 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; +} + /* * flush_reclaim_state(): add pages reclaimed outside of LRU-based reclaim to * scan_control->nr_reclaimed.