From patchwork Tue Sep 8 10:25:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 11763137 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 5B8C9746 for ; Tue, 8 Sep 2020 10:25:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0AA45208C7 for ; Tue, 8 Sep 2020 10:25:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AA45208C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 03C4A6B0002; Tue, 8 Sep 2020 06:25:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F2F036B0037; Tue, 8 Sep 2020 06:25:29 -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 E45736B0055; Tue, 8 Sep 2020 06:25:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id D22EF6B0002 for ; Tue, 8 Sep 2020 06:25:29 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9707B180AD820 for ; Tue, 8 Sep 2020 10:25:29 +0000 (UTC) X-FDA: 77239512378.03.road19_59038a3270d4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 4DF3228A4EA for ; Tue, 8 Sep 2020 10:25:29 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,alex.shi@linux.alibaba.com,,RULES_HIT:30054,0,RBL:47.88.44.36:@linux.alibaba.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100;04y8qhizrsceqdb18yqzbyyzgoqgpyc9fks8grpmuhde8tw8tn4q1s9e63sfnjc.5w8at16prsnyewrcmb1pa1forzr31iu6cybnhqwewcri49jgnpwh79rodsz9oi4.h-lbl8.mailshell.net-223.238.255.100;47.88.44.36-irl.urbl.hostedemail.com-127.0.0.175,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: road19_59038a3270d4 X-Filterd-Recvd-Size: 5643 Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com [47.88.44.36]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Sep 2020 10:25:28 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R521e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0U8IvCd8_1599560724; Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U8IvCd8_1599560724) by smtp.aliyun-inc.com(127.0.0.1); Tue, 08 Sep 2020 18:25:25 +0800 From: Alex Shi To: Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Vladimir Davydov , linux-kernel@vger.kernel.org , linux-mm@kvack.org , cgroups@vger.kernel.org Subject: [PATCH] mm/memcg: rename watermark as max_usage Date: Tue, 8 Sep 2020 18:25:21 +0800 Message-Id: <1599560721-68915-1-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 X-Rspamd-Queue-Id: 4DF3228A4EA X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: The page_counter's watermark used to show as max_usage_in_bytes in memory cgroup. named as watermark is a kind of misleadking. So, let's rename it as it usage. Signed-off-by: Alex Shi Cc: Andrew Morton Cc: Johannes Weiner Cc: Michal Hocko Cc: Vladimir Davydov Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: cgroups@vger.kernel.org --- include/linux/page_counter.h | 6 +++--- mm/hugetlb_cgroup.c | 8 ++++---- mm/memcontrol.c | 4 ++-- mm/page_counter.c | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/linux/page_counter.h b/include/linux/page_counter.h index 85bd413e784e..813f2da26c36 100644 --- a/include/linux/page_counter.h +++ b/include/linux/page_counter.h @@ -25,7 +25,7 @@ struct page_counter { atomic_long_t children_low_usage; /* legacy */ - unsigned long watermark; + unsigned long max_usage; /* max_usage_in_bytes */ unsigned long failcnt; }; @@ -67,9 +67,9 @@ static inline void page_counter_set_high(struct page_counter *counter, int page_counter_memparse(const char *buf, const char *max, unsigned long *nr_pages); -static inline void page_counter_reset_watermark(struct page_counter *counter) +static inline void page_counter_reset_max_usage(struct page_counter *counter) { - counter->watermark = page_counter_read(counter); + counter->max_usage = page_counter_read(counter); } #endif /* _LINUX_PAGE_COUNTER_H */ diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 1f87aec9ab5c..c7484f5eb8ef 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -437,9 +437,9 @@ static u64 hugetlb_cgroup_read_u64(struct cgroup_subsys_state *css, case RES_RSVD_LIMIT: return (u64)rsvd_counter->max * PAGE_SIZE; case RES_MAX_USAGE: - return (u64)counter->watermark * PAGE_SIZE; + return (u64)counter->max_usage * PAGE_SIZE; case RES_RSVD_MAX_USAGE: - return (u64)rsvd_counter->watermark * PAGE_SIZE; + return (u64)rsvd_counter->max_usage * PAGE_SIZE; case RES_FAILCNT: return counter->failcnt; case RES_RSVD_FAILCNT: @@ -553,10 +553,10 @@ static ssize_t hugetlb_cgroup_reset(struct kernfs_open_file *of, switch (MEMFILE_ATTR(of_cft(of)->private)) { case RES_MAX_USAGE: - page_counter_reset_watermark(counter); + page_counter_reset_max_usage(counter); break; case RES_RSVD_MAX_USAGE: - page_counter_reset_watermark(rsvd_counter); + page_counter_reset_max_usage(rsvd_counter); break; case RES_FAILCNT: counter->failcnt = 0; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 8c74f1200261..21b73de53073 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3559,7 +3559,7 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css, case RES_LIMIT: return (u64)counter->max * PAGE_SIZE; case RES_MAX_USAGE: - return (u64)counter->watermark * PAGE_SIZE; + return (u64)counter->max_usage * PAGE_SIZE; case RES_FAILCNT: return counter->failcnt; case RES_SOFT_LIMIT: @@ -3839,7 +3839,7 @@ static ssize_t mem_cgroup_reset(struct kernfs_open_file *of, char *buf, switch (MEMFILE_ATTR(of_cft(of)->private)) { case RES_MAX_USAGE: - page_counter_reset_watermark(counter); + page_counter_reset_max_usage(counter); break; case RES_FAILCNT: counter->failcnt = 0; diff --git a/mm/page_counter.c b/mm/page_counter.c index afe22ad335cc..d88ee074f4a6 100644 --- a/mm/page_counter.c +++ b/mm/page_counter.c @@ -75,10 +75,10 @@ void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) propagate_protected_usage(c, new); /* * This is indeed racy, but we can live with some - * inaccuracy in the watermark. + * inaccuracy in the max_usage. */ - if (new > READ_ONCE(c->watermark)) - WRITE_ONCE(c->watermark, new); + if (new > READ_ONCE(c->max_usage)) + WRITE_ONCE(c->max_usage, new); } } @@ -129,10 +129,10 @@ bool page_counter_try_charge(struct page_counter *counter, propagate_protected_usage(c, new); /* * Just like with failcnt, we can live with some - * inaccuracy in the watermark. + * inaccuracy in the max_usage. */ - if (new > READ_ONCE(c->watermark)) - WRITE_ONCE(c->watermark, new); + if (new > READ_ONCE(c->max_usage)) + WRITE_ONCE(c->max_usage, new); } return true;