Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1636665pxu; Sun, 6 Dec 2020 02:23:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzL/xvVqIP5bst4JNnXQaQPhTfjfEcWepoW1RYAFYTv81oRVU48U7BII5KOScs5kqTFgZnU X-Received: by 2002:a17:906:e247:: with SMTP id gq7mr710977ejb.27.1607250189705; Sun, 06 Dec 2020 02:23:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607250189; cv=none; d=google.com; s=arc-20160816; b=D/blV7iA7tB0yLNDjqOv0UOtnJu9abEXgreR2L5c19tVJcD4OXIYF9pb5T9NERcMGz So4TTlUGUIsRGmFDHHm+J2ISP85q/L2ETaimdRltM3iDB4oo7FPE1PWBWCG29xywjpie ij1X/lWFNWS01PTTyuMENDjnHtVUul/hrwU3NTCEg8YKyz1H2Mb2bHS626sxQ01ztdLk 3aliR1FacZ+wUbBzHt0M1bcVZrcpER5Zwrfs9PAE6ifoIRLWNyW/G+x/Y6YTZsksrtiL 2LrrLp08gmd9XmJAjoEtJiwCQo01w6+cBIUbyzXDPuRUOmVLcMDNQHq3XgK3a7toj/rx AUtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=47URTm8Dh9aVQTOnIPzCjSnQ3r0uw/hpFPQHZdAjXJk=; b=tgfvw+Zf/tI7T5x2vb+IPy1PDrsDoTlXUrJ7uDnYGLTASqCSVT0aNe5ThZbX2EJyX/ k/9SFamKM7EpfHTctXBeJh1rQZdGTEG8BYdTDmbmrJEnOj0QTzZTaDx/A/q3zz3F2oYK Uw8Sn37JH51g3lkGf+N3ZZJLj55HICvOyi+nMRMOjzepuGFpttfg/U87BKHrSOZ5bW1a pdEtEMJwNts0245bqv3gcSCShZ/aL2nZg8yb9ffBXnfvSIlDZXenkMgivF5ykhuisK9/ sc5H+vBz2C0lTTy3jVF8FkpiXXN5OlUhYy5P/A6XcQyeUHiQrFZF6zAKzgwx0SrrVuDH aJsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=ZFrm0RAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l2si6284049edf.467.2020.12.06.02.22.47; Sun, 06 Dec 2020 02:23:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=ZFrm0RAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727357AbgLFKSl (ORCPT + 99 others); Sun, 6 Dec 2020 05:18:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727240AbgLFKSk (ORCPT ); Sun, 6 Dec 2020 05:18:40 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 404F9C0613D1 for ; Sun, 6 Dec 2020 02:17:43 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id o4so6466785pgj.0 for ; Sun, 06 Dec 2020 02:17:43 -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=47URTm8Dh9aVQTOnIPzCjSnQ3r0uw/hpFPQHZdAjXJk=; b=ZFrm0RAsDKjEspMJB3v1V7ooekc7E7o5kl6qta47nxPfgFfA0L3kv9YJmSyWr+/B31 JHbHQopIMAu9OZDsv9OzAyQyEvdtpOUYOU4uChMVGIF7Rha4Kuyjtf6rvPmWRFq5r0Hb YpLTSeIofdez0J4pdps2gKdUCVEdB8v5HEpGQlyPdg9S6BnGVAvnNjCt9SvzcI6vyvP0 AnBBUWKm3mxAbbRDBv+EBHvtTprB++jbhIeX1HnMXf4B51kCpzqpciDO6VLGjCSqEfqj l7aae0EI4r2sW1m8S0lkLyNyXIeCmU8aRNz4NeRgVcg0KuTQ+ZB92ejjuYcxaPQNk/6O FZjQ== 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=47URTm8Dh9aVQTOnIPzCjSnQ3r0uw/hpFPQHZdAjXJk=; b=E1sLJbKjesF0GRA6Ocg7/WwkRjVIuHNo6wtbA5E/SckGaNC/HwPTL/YgD3qbpZ7ckv IiCt/YTB1RG3sT2T+HlA/qxKkj5UWUS0FVhDrVLxhfQ6dd8HaFTve8esO4ld6RsPGdlZ YZLEBI71Q3gimZnR45xBm+5PBqL1BnG1KmSmFh7Fq0QzBu/JzyC79BuAOkpDYzm3OmcR XyuGkhA1tXdxA0ORpNFprNDx6bU8CyzeQsVaE+PS8oHcoJNEsKHABtVcsF36K1ehuwmV 5SurcrqPkSIJ2nxkDZdxiTaaqUpYTrQgQLOY5rhZaiiOUmq+Ll+SnrGiH4/YoDxdvPnj LuhQ== X-Gm-Message-State: AOAM5300UtzV1bv0vhU5PhWs2zpATry0GNC6XT6+GHufm1V+eNlcX/8N 1udkQJFys8eQ5g7r+0E7RcSHKQ== X-Received: by 2002:a62:6346:0:b029:198:3d33:feb with SMTP id x67-20020a6263460000b02901983d330febmr11740529pfb.8.1607249862830; Sun, 06 Dec 2020 02:17:42 -0800 (PST) Received: from localhost.localdomain ([103.136.221.70]) by smtp.gmail.com with ESMTPSA id g16sm10337657pfb.201.2020.12.06.02.17.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Dec 2020 02:17:42 -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, will@kernel.org, guro@fb.com, rppt@kernel.org, tglx@linutronix.de, esyr@redhat.com, peterx@redhat.com, krisman@collabora.com, surenb@google.com, avagin@openvz.org, elver@google.com, rdunlap@infradead.org, iamjoonsoo.kim@lge.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Muchun Song Subject: [RESEND PATCH v2 06/12] mm: memcontrol: convert NR_FILE_PMDMAPPED account to pages Date: Sun, 6 Dec 2020 18:14:45 +0800 Message-Id: <20201206101451.14706-7-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20201206101451.14706-1-songmuchun@bytedance.com> References: <20201206101451.14706-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert NR_FILE_PMDMAPPED account to pages Signed-off-by: Muchun Song --- drivers/base/node.c | 3 +-- fs/proc/meminfo.c | 2 +- mm/rmap.c | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index e5abc6144dab..f77652e6339f 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -465,8 +465,7 @@ static ssize_t node_read_meminfo(struct device *dev, nid, K(node_page_state(pgdat, NR_SHMEM_THPS)), 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) + nid, K(node_page_state(pgdat, NR_FILE_PMDMAPPED)) #endif ); len += hugetlb_report_node_meminfo(buf, len, nid); diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index 84886b2cc2f7..5a83012d8b72 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -137,7 +137,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) show_val_kb(m, "FileHugePages: ", global_node_page_state(NR_FILE_THPS)); show_val_kb(m, "FilePmdMapped: ", - global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR); + global_node_page_state(NR_FILE_PMDMAPPED)); #endif #ifdef CONFIG_CMA diff --git a/mm/rmap.c b/mm/rmap.c index 3089ad6bf468..e383c5619501 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1222,7 +1222,8 @@ void page_add_file_rmap(struct page *page, bool compound) __mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED, HPAGE_PMD_NR); else - __inc_node_page_state(page, NR_FILE_PMDMAPPED); + __mod_lruvec_page_state(page, NR_FILE_PMDMAPPED, + HPAGE_PMD_NR); } else { if (PageTransCompound(page) && page_mapping(page)) { VM_WARN_ON_ONCE(!PageLocked(page)); @@ -1264,7 +1265,8 @@ static void page_remove_file_rmap(struct page *page, bool compound) __mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED, -HPAGE_PMD_NR); else - __dec_node_page_state(page, NR_FILE_PMDMAPPED); + __mod_lruvec_page_state(page, NR_FILE_PMDMAPPED, + -HPAGE_PMD_NR); } else { if (!atomic_add_negative(-1, &page->_mapcount)) return; -- 2.11.0