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: 78796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2670141vqo; Mon, 3 Apr 2023 17:24:27 -0700 (PDT) X-Google-Smtp-Source: AKy350Y54sygDxZIDU1mJX88HQTd8lbeskyrozsGlbdWa3E2mA7awpy3fQ+ctjPv3DbJv+kNaCMX X-Received: by 2002:a17:90b:1b4a:b0:241:b90:4a1c with SMTP id nv10-20020a17090b1b4a00b002410b904a1cmr617612pjb.44.1680567867348; Mon, 03 Apr 2023 17:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680567867; cv=none; d=google.com; s=arc-20160816; b=bhv9f9lKhS2Bo+t5GmybvZHRMOtGkQhsquQ1kiAbe0EV8w86vJXhCePW/Q7TfBUftf eGQ2tnX0Gl+CqfsGDWrGTLvLBkZm8mi5Wr39p8R/3MWWZUNyeL28WzrjE6EogBjO8qRT daNZZYuzSlk98JQquU1mR+iK+dmyaz9BkMALv3XJX0VjG6JeW8LdSEiGGmait6KwQVXG 0xAPk3SLgf1I5QxcfJovie8ZBgkeTvqyKYJEnTki957yR8BBXC49V0XAHyIrS688Rbxk IQZunvGntyFfCPBcpA0fehonfN4CqIkk9ZeugqsQVOUgyoGsEyCyl8ePqS7ZfKghD4C8 6Zvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=/hxuqZFO5U+CmKAu0Izd1qiRBhW4afUnD0WyfUo4Gcw=; b=aBAle02kfPnrR1kuy7p4z/UN5MTEGZvwdgWje/SvgJrHV+RCOvCOy7BP/x5oC9gdv7 p3tkNkaF0WjB3bJIsECFXdozrC4LFPGBDtmCEAa60bUQlLLnWSbaLb2p/dENSD43oeKq Iniis/QYTLOu1VAc/CWeJpSM/bhaNbEliUcAROgRL/df/mHD2Wz3l58jGBAu6aFgtAZF VyeWE8X9+bMAVi/lWkO+/CDnx2Fkjd3B6KanpugstnVVz2n2t3eSMWaAtHvduHvawUcI 1QFSc2IQSI1+ze5SqKaVm62utBbfsk1elvFW/L8ksH+cSyHKO3HTWEf289Svr/afZUJQ O8zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ERBMFlpw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mj24-20020a17090b369800b002336940f887si8724540pjb.61.2023.04.03.17.24.14; Mon, 03 Apr 2023 17:24:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ERBMFlpw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231750AbjDDAOF (ORCPT + 99 others); Mon, 3 Apr 2023 20:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231248AbjDDAN7 (ORCPT ); Mon, 3 Apr 2023 20:13:59 -0400 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A7CD3C14 for ; Mon, 3 Apr 2023 17:13:58 -0700 (PDT) Received: by mail-pl1-x64a.google.com with SMTP id x4-20020a170902ec8400b001a1a5f6f272so18251142plg.1 for ; Mon, 03 Apr 2023 17:13:58 -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=FB6O2ZPhwCGI5J6hY4vz8wxbUloouw3UWQ6Vadf+tFJ4KMyq8oONGuA1CfOZc8KAdQ eAbNCokXZtgzY4zVrUjWqahVxV1eK45rE/vpRYCyqh0p9lyMsGisa6LHX8gYin6848gi NvKvSgBm6AIFK85VXtRoUSTsNPXitPO5kT+d07H1HT6quEzIEFJsCNNHTK9DJKS6/PI2 CVD1jcFcQLdYMRuZR4RNqHWSDpbRQ99ChTiT1hZLsnWUuQPL4w73IT8q2oNqd1l4S+M6 +cBCuUNJtsy++vfQOuUrMyLtoS53fPC4Ysq2a1ZM0ix8EkweAxgEWaP6sfX8L2skWqu1 IOeQ== X-Gm-Message-State: AAQBX9fDjzxePFXfcKFZtI40oyhCsX5XWk388fVcXFq+GHu9pJe0RW8Q bp/KK2jNBDcznLj1Ovrn/WjKtXK3a4DzT3bb 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-Spam-Status: No, score=-7.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762203131692001621?= X-GMAIL-MSGID: =?utf-8?q?1762203131692001621?= 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) {