From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FA24C54FCB for ; Sat, 25 Apr 2020 15:24:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 041AC20748 for ; Sat, 25 Apr 2020 15:24:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BO36yHOS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 041AC20748 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 99A668E0006; Sat, 25 Apr 2020 11:24:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D40A8E0003; Sat, 25 Apr 2020 11:24:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C47D8E0006; Sat, 25 Apr 2020 11:24:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id 5C54B8E0003 for ; Sat, 25 Apr 2020 11:24:47 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2B411584F for ; Sat, 25 Apr 2020 15:24:47 +0000 (UTC) X-FDA: 76746749814.02.kick98_29be0019ee21a X-HE-Tag: kick98_29be0019ee21a X-Filterd-Recvd-Size: 8826 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Sat, 25 Apr 2020 15:24:46 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id t16so4912262plo.7 for ; Sat, 25 Apr 2020 08:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oPQ0/ra/CT+fnXD9tUyaPtNKzAkYz3m+rkUFAp6sa5U=; b=BO36yHOSp0L4kzZVXdfFvofEWMM2dt3VmbM2WX76uOsKcVhAsH2dqTeV6YxAIxadKt RmXpgBdaNgqefXK/nn6lDmlxD6SjkNkztXY+ukgswOImYAJmQSYvoihqwdAqKiwT1kN9 ZSkLC2Iiq9+yflzk6quL0GyRPf4xJ5ECo6WGO0M+yqQvGbn2lLwQC+jx12MvWe4k623v iFvZYrui7LGhBFSMdBtLMJtOr9YnLM81up3aNPqjWucgRh8MwiEai+HT95UofMCcgolt 3XcddnL1lJW0YnUjZ2MQKsqCWV7X/sc9W/rf5eC+odBQUuzQwCDX3S1cJ4OyX+3kHxwP lY0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oPQ0/ra/CT+fnXD9tUyaPtNKzAkYz3m+rkUFAp6sa5U=; b=pcyeIzNg3L6EDZEzvBTkgfnhY/OgYQ8PRUwPZIPykZNkVlVAYsZe1EZgCya7bAudmt MLcA9R+8lS7hRVa7jIMMoEBcCWOtbXqNYdcBnuxeIVdtMy1doi3RCLdyL/t6Mt6l3cNx NLqIBmtyvZaJ9Pua8Juvv0dUbTCw412xCz86XBsXYrrbI10d7CWdvhBDHdeozSaosAdK Xxx2F3wzX5Y+/tztxq1ILEI+xONlCoxyezmwHciGiDyIU3ByPfguxUm+yZz6vWhEr8s4 s1nRgu2DOzTwGE6/s13BU/rmsZ2s4TqQ27fEuvZPPI9nkXngobOU0t0t/LV6J+35ICQe 4L1g== X-Gm-Message-State: AGi0PuZPg0hskp8C9wY/3TydAY0WfCvRoEhLSGoYqv8OEadKKBXefQaP qkN3EK/U95HKo2BKYTwWulk= X-Google-Smtp-Source: APiQypIhrpcGyCxbG79EE7bXlmF2C+gqdEiguIqfzxcjZTjWMqjCEdz5PvyZhTfk4roWuu/6K118+A== X-Received: by 2002:a17:90a:1f4b:: with SMTP id y11mr13223153pjy.136.1587828285810; Sat, 25 Apr 2020 08:24:45 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id w11sm7319838pgj.4.2020.04.25.08.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Apr 2020 08:24:45 -0700 (PDT) From: Yafang Shao To: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, guro@fb.com, chris@chrisdown.name Cc: linux-mm@kvack.org, Yafang Shao Subject: [PATCH 1/3] mm: move struct scan_control into internal.h Date: Sat, 25 Apr 2020 11:24:16 -0400 Message-Id: <20200425152418.28388-2-laoar.shao@gmail.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20200425152418.28388-1-laoar.shao@gmail.com> References: <20200425152418.28388-1-laoar.shao@gmail.com> 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: This struct will be used in multiple source file under mm/, so move the definition of it into mm/internal.h. Cc: Johannes Weiner Cc: Michal Hocko Cc: Roman Gushchin Cc: Chris Down Signed-off-by: Yafang Shao --- mm/internal.h | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ mm/vmscan.c | 83 -------------------------------------------------- 2 files changed, 84 insertions(+), 83 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index b5634e78f01d..a0b3bdd933b9 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -11,6 +11,7 @@ #include #include #include +#include /* * The set of flags that only affect watermark checking and reclaim @@ -254,6 +255,89 @@ int find_suitable_fallback(struct free_area *area, unsigned int order, #endif +struct scan_control { + /* How many pages shrink_list() should reclaim */ + unsigned long nr_to_reclaim; + + /* + * Nodemask of nodes allowed by the caller. If NULL, all nodes + * are scanned. + */ + nodemask_t *nodemask; + + /* + * The memory cgroup that hit its limit and as a result is the + * primary target of this reclaim invocation. + */ + struct mem_cgroup *target_mem_cgroup; + + /* Can active pages be deactivated as part of reclaim? */ +#define DEACTIVATE_ANON 1 +#define DEACTIVATE_FILE 2 + unsigned int may_deactivate:2; + unsigned int force_deactivate:1; + unsigned int skipped_deactivate:1; + + /* Writepage batching in laptop mode; RECLAIM_WRITE */ + unsigned int may_writepage:1; + + /* Can mapped pages be reclaimed? */ + unsigned int may_unmap:1; + + /* Can pages be swapped as part of reclaim? */ + unsigned int may_swap:1; + + /* + * Cgroups are not reclaimed below their configured memory.low, + * unless we threaten to OOM. If any cgroups are skipped due to + * memory.low and nothing was reclaimed, go back for memory.low. + */ + unsigned int memcg_low_reclaim:1; + unsigned int memcg_low_skipped:1; + + unsigned int hibernation_mode:1; + + /* One of the zones is ready for compaction */ + unsigned int compaction_ready:1; + + /* There is easily reclaimable cold cache in the current node */ + unsigned int cache_trim_mode:1; + + /* The file pages on the current node are dangerously low */ + unsigned int file_is_tiny:1; + + /* Allocation order */ + s8 order; + + /* Scan (total_size >> priority) pages at once */ + s8 priority; + + /* The highest zone to isolate pages for reclaim from */ + s8 reclaim_idx; + + /* This context's GFP mask */ + gfp_t gfp_mask; + + /* Incremented by the number of inactive pages that were scanned */ + unsigned long nr_scanned; + + /* Number of pages freed so far during a call to shrink_zones() */ + unsigned long nr_reclaimed; + + struct { + unsigned int dirty; + unsigned int unqueued_dirty; + unsigned int congested; + unsigned int writeback; + unsigned int immediate; + unsigned int file_taken; + unsigned int taken; + } nr; + + /* for recording the reclaimed slab by now */ + struct reclaim_state reclaim_state; +}; + /* * This function returns the order of a free page in the buddy system. In * general, page_zone(page)->lock must be held by the caller to prevent the diff --git a/mm/vmscan.c b/mm/vmscan.c index b06868fc4926..4c98512e2c9f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -63,89 +63,6 @@ #define CREATE_TRACE_POINTS #include -struct scan_control { - /* How many pages shrink_list() should reclaim */ - unsigned long nr_to_reclaim; - - /* - * Nodemask of nodes allowed by the caller. If NULL, all nodes - * are scanned. - */ - nodemask_t *nodemask; - - /* - * The memory cgroup that hit its limit and as a result is the - * primary target of this reclaim invocation. - */ - struct mem_cgroup *target_mem_cgroup; - - /* Can active pages be deactivated as part of reclaim? */ -#define DEACTIVATE_ANON 1 -#define DEACTIVATE_FILE 2 - unsigned int may_deactivate:2; - unsigned int force_deactivate:1; - unsigned int skipped_deactivate:1; - - /* Writepage batching in laptop mode; RECLAIM_WRITE */ - unsigned int may_writepage:1; - - /* Can mapped pages be reclaimed? */ - unsigned int may_unmap:1; - - /* Can pages be swapped as part of reclaim? */ - unsigned int may_swap:1; - - /* - * Cgroups are not reclaimed below their configured memory.low, - * unless we threaten to OOM. If any cgroups are skipped due to - * memory.low and nothing was reclaimed, go back for memory.low. - */ - unsigned int memcg_low_reclaim:1; - unsigned int memcg_low_skipped:1; - - unsigned int hibernation_mode:1; - - /* One of the zones is ready for compaction */ - unsigned int compaction_ready:1; - - /* There is easily reclaimable cold cache in the current node */ - unsigned int cache_trim_mode:1; - - /* The file pages on the current node are dangerously low */ - unsigned int file_is_tiny:1; - - /* Allocation order */ - s8 order; - - /* Scan (total_size >> priority) pages at once */ - s8 priority; - - /* The highest zone to isolate pages for reclaim from */ - s8 reclaim_idx; - - /* This context's GFP mask */ - gfp_t gfp_mask; - - /* Incremented by the number of inactive pages that were scanned */ - unsigned long nr_scanned; - - /* Number of pages freed so far during a call to shrink_zones() */ - unsigned long nr_reclaimed; - - struct { - unsigned int dirty; - unsigned int unqueued_dirty; - unsigned int congested; - unsigned int writeback; - unsigned int immediate; - unsigned int file_taken; - unsigned int taken; - } nr; - - /* for recording the reclaimed slab by now */ - struct reclaim_state reclaim_state; -}; - #ifdef ARCH_HAS_PREFETCHW #define prefetchw_prev_lru_page(_page, _base, _field) \ do { \ -- 2.18.2