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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 DE57CECE58B for ; Wed, 2 Oct 2019 12:24:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9CC2F21A4C for ; Wed, 2 Oct 2019 12:24:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CC2F21A4C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 441FB6B000A; Wed, 2 Oct 2019 08:24:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F0E86B000C; Wed, 2 Oct 2019 08:24:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 307796B000D; Wed, 2 Oct 2019 08:24:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 0F4716B000A for ; Wed, 2 Oct 2019 08:24:20 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id A021E75BF for ; Wed, 2 Oct 2019 12:24:19 +0000 (UTC) X-FDA: 75998762238.12.rain79_89fa896fa633 X-HE-Tag: rain79_89fa896fa633 X-Filterd-Recvd-Size: 3657 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Oct 2019 12:24:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 92A90AD09; Wed, 2 Oct 2019 12:24:17 +0000 (UTC) Date: Wed, 2 Oct 2019 14:24:14 +0200 From: Michal Hocko To: Yafang Shao Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com, linux-mm@kvack.org Subject: Re: [PATCH] mm, memcg: clean up reclaim iter array Message-ID: <20191002122414.GK15624@dhcp22.suse.cz> References: <1569897728-1686-1-git-send-email-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1569897728-1686-1-git-send-email-laoar.shao@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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: On Mon 30-09-19 22:42:08, Yafang Shao wrote: > The mem_cgroup_reclaim_cookie is only used in memcg softlimit reclaim now, > and the priority of the reclaim is always 0. We don't need to define the > iter in struct mem_cgroup_per_node as an array any more. That could make > the code more clear and save some space. > > Signed-off-by: Yafang Shao Any changes to the soft limit reclaim are unlikely to happen so I tend to agree that further simplification of the iterator is desirable. Acked-by: Michal Hocko Thanks! > --- > include/linux/memcontrol.h | 3 +-- > mm/memcontrol.c | 11 +++-------- > 2 files changed, 4 insertions(+), 10 deletions(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index 0c762e8..7d99a65 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -58,7 +58,6 @@ enum mem_cgroup_protection { > > struct mem_cgroup_reclaim_cookie { > pg_data_t *pgdat; > - int priority; > unsigned int generation; > }; > > @@ -126,7 +125,7 @@ struct mem_cgroup_per_node { > > unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; > > - struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; > + struct mem_cgroup_reclaim_iter iter; > > struct memcg_shrinker_map __rcu *shrinker_map; > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 1c4c08b..5d9b00f 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1052,7 +1052,7 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root, > struct mem_cgroup_per_node *mz; > > mz = mem_cgroup_nodeinfo(root, reclaim->pgdat->node_id); > - iter = &mz->iter[reclaim->priority]; > + iter = &mz->iter; > > if (prev && reclaim->generation != iter->generation) > goto out_unlock; > @@ -1152,15 +1152,11 @@ static void __invalidate_reclaim_iterators(struct mem_cgroup *from, > struct mem_cgroup_reclaim_iter *iter; > struct mem_cgroup_per_node *mz; > int nid; > - int i; > > for_each_node(nid) { > mz = mem_cgroup_nodeinfo(from, nid); > - for (i = 0; i <= DEF_PRIORITY; i++) { > - iter = &mz->iter[i]; > - cmpxchg(&iter->position, > - dead_memcg, NULL); > - } > + iter = &mz->iter; > + cmpxchg(&iter->position, dead_memcg, NULL); > } > } > > @@ -1705,7 +1701,6 @@ static int mem_cgroup_soft_reclaim(struct mem_cgroup *root_memcg, > unsigned long nr_scanned; > struct mem_cgroup_reclaim_cookie reclaim = { > .pgdat = pgdat, > - .priority = 0, > }; > > excess = soft_limit_excess(root_memcg); > -- > 1.8.3.1 -- Michal Hocko SUSE Labs