From patchwork Tue Oct 1 02:42:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11167931 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C81A914DB for ; Tue, 1 Oct 2019 02:42:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 89A022168B for ; Tue, 1 Oct 2019 02:42:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Nyt8XUXn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89A022168B 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 ACF776B0005; Mon, 30 Sep 2019 22:42:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A585B6B0006; Mon, 30 Sep 2019 22:42:25 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91ED56B0007; Mon, 30 Sep 2019 22:42:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 6B8556B0005 for ; Mon, 30 Sep 2019 22:42:25 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 0ADD01EE6 for ; Tue, 1 Oct 2019 02:42:25 +0000 (UTC) X-FDA: 75993667050.18.edge67_6c57cb6a89407 X-Spam-Summary: 2,0,0,6ea902147e994156,d41d8cd98f00b204,laoar.shao@gmail.com,:akpm@linux-foundation.org:mhocko@kernel.org:hannes@cmpxchg.org:vdavydov.dev@gmail.com::laoar.shao@gmail.com,RULES_HIT:41:355:379:541:800:960:973:981:988:989:1260:1345:1437:1534:1542:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3874:4321:4605:5007:6261:6653:7514:9413:10004:11026:11473:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12895:13161:13229:14181:14394:14687:14721:21080:21444:21451:21627:21666:21740:30012:30054,0,RBL:209.85.210.195:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: edge67_6c57cb6a89407 X-Filterd-Recvd-Size: 4873 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Oct 2019 02:42:24 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id q7so6829463pfh.8 for ; Mon, 30 Sep 2019 19:42:24 -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; bh=KCSgPg2RBIDL55p0zhNUa6csNsydfSPiDOMOTKFbrzM=; b=Nyt8XUXn/pUu+9DQJYoUyYYLmzluKIhiqC6qG5D7i6RlQG4nr7wyOWTWLIu+U3Tyu0 j+AZelUKpVbTNTw+Ce0ps2tA4jQkC8YLmkvGYob8WBFzihCVDCZ1KPwzbxV2wk8w0oTM hjmg9oeYqwRSDj1uxG71R2CrBSwEX6CvcArtVy9W6XrpmHpluNLZJ92yph93Q9ZSxmVn bZdSL/QaHTOcR2F+/3GengdDUCsjwP7rGrEXXcsvVVQaAxd4/zOQHsj4P9vwYReAhicF ipn+JBS0532WP86iAs5AVE9VcBYvQZBmrhxF7qFRPJCda7fiRx7iX6CNqNKNEEs9Tr0+ 3kHg== 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; bh=KCSgPg2RBIDL55p0zhNUa6csNsydfSPiDOMOTKFbrzM=; b=JnprDt9PBnZatmKl29MmZZVmfKRFRRGyYPnt5IQpQvErqEFfAWGXDXOzCGMXXCIhdb Ru81knMREjVSXTlXb//cUQOnKSpeqxVaEmPamUqOiOeoPBUKepyoGoorv9xJrs9XfU9C woxJE/NrEBVkm/0HqbPtdYilcHoPuYEqM1KBK7KsUMBq3uODWJliMN6D2rJhCXg6NHz9 pYrL0I1pNZ0ts4PbR7PjhFSmqGjP3psBo4W2KqTOX7JhG2r5wDLyF8henP3X/0fV/5Y4 e4OdZiUkA7EsOe5HVXpXCCRuSMChBDEiDT1BGZxVP7iMD5ZtYBF0L8BY7mk8vaRCTtkZ B/hg== X-Gm-Message-State: APjAAAU+jNeLzWDIbhcgnY5torSXfO8hGzIOWDKpyH+Jvsu2NpJI4L5Q OpbUQmFSjyEUJLHedj28fZE= X-Google-Smtp-Source: APXvYqyYLxlvhMghWN0GF7NqiN+G8HbnmB+ilX2UKJNex999WVWd3q3IzwW73xIR1vq/Ew6aUWG2iA== X-Received: by 2002:a65:6659:: with SMTP id z25mr28098813pgv.23.1569897743383; Mon, 30 Sep 2019 19:42:23 -0700 (PDT) Received: from dev.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id p189sm14891929pga.2.2019.09.30.19.42.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Sep 2019 19:42:22 -0700 (PDT) From: Yafang Shao To: akpm@linux-foundation.org, mhocko@kernel.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com Cc: linux-mm@kvack.org, Yafang Shao Subject: [PATCH] mm, memcg: clean up reclaim iter array Date: Mon, 30 Sep 2019 22:42:08 -0400 Message-Id: <1569897728-1686-1-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Acked-by: Michal Hocko --- 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);