From patchwork Tue Dec 8 04:18:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 11957541 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 AA4C3C4167B for ; Tue, 8 Dec 2020 04:21:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F44A23A61 for ; Tue, 8 Dec 2020 04:21:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F44A23A61 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DB2698D001F; Mon, 7 Dec 2020 23:21:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D61BC8D0002; Mon, 7 Dec 2020 23:21:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C78158D001F; Mon, 7 Dec 2020 23:21:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id AE3F98D0002 for ; Mon, 7 Dec 2020 23:21:29 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7E0A6181AEF21 for ; Tue, 8 Dec 2020 04:21:29 +0000 (UTC) X-FDA: 77568815898.04.paper63_310cc88273e4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 6267480081D8 for ; Tue, 8 Dec 2020 04:21:29 +0000 (UTC) X-HE-Tag: paper63_310cc88273e4 X-Filterd-Recvd-Size: 6485 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Dec 2020 04:21:28 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id c79so12642021pfc.2 for ; Mon, 07 Dec 2020 20:21:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5QtzUPSaCCxeqzmaLwiZLdmUDR0T79YdbdBWjz3bjU0=; b=mc4LQi+8Dvw0LMhxU20Dluvm2ZSyZowOBRFKbsg4+E2QKQkG+5WEUvL3sq7+H+KsIG /2PbPyQsG1YW1ToGRNXGF9EmUdWNsHJTkjDCNcOvPqwNrTOViEnPA2kmUGOPQ9xIR8bm YGC4aheG0ammcsnwywGtpfGNKK9Zd3GigZ61K7sz44/qSRPuehM2Qqwo12E4wpkhvrH9 aAnnFsNssqM9nCLjet0TxIL/KzaOE4fRuZwnTtNc5sEgPGlBOlMLBSSz0y72K1ctDj6D S51rJ0KDs5C1EOhBpJH1OXIpV3SRLdo7Raf1opYzy5xE0kanXE5ccDXXUhjDIkAzh3T0 X7fg== 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:mime-version:content-transfer-encoding; bh=5QtzUPSaCCxeqzmaLwiZLdmUDR0T79YdbdBWjz3bjU0=; b=IZZKUgaBiarkpBPDTByb0e12rTBptNFb1IPFJP80PsM/z+/sATMQoDICEObJAqG4ZH SM5EQSHBv7zmueiyQPSyrYIV/jj8/IiLoi3REUoGc7StjqJ0WIIuuxI8WhuulHQhSSBu 1mCsEP1cMSmTXH51ofAhiyFEN8ugPvIZ1PsJrP+0DaXTcgRoUeqE2bv67yBVxCGIpAQJ HZv0iszBpSkv0R10gbVeCSBcXvQs/MyrvWQrbAmM5UYaOh8pRW151NITL7K7gBLEDDLZ CwgyamTamtIIjCnP/USHNHAtbVqFe7g3jVer+GB/6wzpipE02EcznLlj2/eNUxT/Fh+5 WURw== X-Gm-Message-State: AOAM531K1EbhtwEHaMcehv22IGkxrbhPSv3Xd5pAhO+I7I1N1Y2eTn7z Qg0tP8UVMES6EyYMIR7E89gdnA== X-Google-Smtp-Source: ABdhPJwgTvXrSNNUdeX86od1g83iYDUqnnM9L9ZoCFjA9qyAxMxXscN568YbBrQgdQtIM9Jk5wEabQ== X-Received: by 2002:a62:5c87:0:b029:197:5f13:b66c with SMTP id q129-20020a625c870000b02901975f13b66cmr19288373pfb.73.1607401288139; Mon, 07 Dec 2020 20:21:28 -0800 (PST) Received: from localhost.localdomain ([103.136.221.70]) by smtp.gmail.com with ESMTPSA id mr7sm1031166pjb.31.2020.12.07.20.21.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Dec 2020 20:21:27 -0800 (PST) From: Muchun Song To: gregkh@linuxfoundation.org, rafael@kernel.org, adobriyan@gmail.com, akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, hughd@google.com, shakeelb@google.com, guro@fb.com, samitolvanen@google.com, feng.tang@intel.com, neilb@suse.de, iamjoonsoo.kim@lge.com, rdunlap@infradead.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Muchun Song Subject: [PATCH v3 5/7] mm: memcontrol: convert NR_SHMEM_PMDMAPPED account to pages Date: Tue, 8 Dec 2020 12:18:45 +0800 Message-Id: <20201208041847.72122-6-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20201208041847.72122-1-songmuchun@bytedance.com> References: <20201208041847.72122-1-songmuchun@bytedance.com> MIME-Version: 1.0 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 unit of NR_SHMEM_PMDMAPPED is HPAGE_PMD_NR. Convert NR_SHMEM_PMDMAPPED account to pages. Signed-off-by: Muchun Song --- drivers/base/node.c | 3 +-- fs/proc/meminfo.c | 2 +- mm/page_alloc.c | 3 +-- mm/rmap.c | 6 ++++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index a7f298ae693a..45293084bb19 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -463,8 +463,7 @@ static ssize_t node_read_meminfo(struct device *dev, , nid, K(node_page_state(pgdat, NR_ANON_THPS)), nid, K(node_page_state(pgdat, NR_SHMEM_THPS)), - nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) * - HPAGE_PMD_NR), + nid, K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)), nid, K(node_page_state(pgdat, NR_FILE_THPS)), nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED) * HPAGE_PMD_NR) diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index cfb107eaa3e6..c61f440570f9 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -133,7 +133,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) show_val_kb(m, "ShmemHugePages: ", global_node_page_state(NR_SHMEM_THPS)); show_val_kb(m, "ShmemPmdMapped: ", - global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR); + global_node_page_state(NR_SHMEM_PMDMAPPED)); show_val_kb(m, "FileHugePages: ", global_node_page_state(NR_FILE_THPS)); show_val_kb(m, "FilePmdMapped: ", diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 720fb5a220b6..575fbfeea4b5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5578,8 +5578,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask) K(node_page_state(pgdat, NR_SHMEM)), #ifdef CONFIG_TRANSPARENT_HUGEPAGE K(node_page_state(pgdat, NR_SHMEM_THPS)), - K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) - * HPAGE_PMD_NR), + K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)), K(node_page_state(pgdat, NR_ANON_THPS)), #endif K(node_page_state(pgdat, NR_WRITEBACK_TEMP)), diff --git a/mm/rmap.c b/mm/rmap.c index f59e92e26b61..3089ad6bf468 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1219,7 +1219,8 @@ void page_add_file_rmap(struct page *page, bool compound) if (!atomic_inc_and_test(compound_mapcount_ptr(page))) goto out; if (PageSwapBacked(page)) - __inc_node_page_state(page, NR_SHMEM_PMDMAPPED); + __mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED, + HPAGE_PMD_NR); else __inc_node_page_state(page, NR_FILE_PMDMAPPED); } else { @@ -1260,7 +1261,8 @@ static void page_remove_file_rmap(struct page *page, bool compound) if (!atomic_add_negative(-1, compound_mapcount_ptr(page))) return; if (PageSwapBacked(page)) - __dec_node_page_state(page, NR_SHMEM_PMDMAPPED); + __mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED, + -HPAGE_PMD_NR); else __dec_node_page_state(page, NR_FILE_PMDMAPPED); } else {