From patchwork Tue Jun 19 21:08:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10475441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8071B601D7 for ; Tue, 19 Jun 2018 21:09:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E99B28C27 for ; Tue, 19 Jun 2018 21:09:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F79D28C53; Tue, 19 Jun 2018 21:09:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 241B428C27 for ; Tue, 19 Jun 2018 21:09:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE4FF6B0005; Tue, 19 Jun 2018 17:09:04 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EBA816B0006; Tue, 19 Jun 2018 17:09:04 -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 DA9536B0007; Tue, 19 Jun 2018 17:09:04 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id 9B28B6B0005 for ; Tue, 19 Jun 2018 17:09:04 -0400 (EDT) Received: by mail-pf0-f198.google.com with SMTP id a12-v6so413635pfn.12 for ; Tue, 19 Jun 2018 14:09:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=O178fy/494JJ6MqBFh6T5/+wTFyihphrOdyqU6D6Ivk=; b=bO4SYGPE0f4hCy3VCDXbh44u45NzxI78AVQGYhhgKitczs8ACLpUoB6Zjk1fhWv8GI DbyrWBEu18Ux4uxRNeQP2gTkxb012aYS+reh64VgF5bBmpat+QZQb9tdSqIDa0w4WJRm JhMeS+vqJWGqZXSXmU7gGGOJ+2e9OH3CjZOHuFsdWgDdQClfOEQrhj2j6z2HCu1OC3/L 9eipw6GEZdNQRiwQA0iegm3MQLaiI5EJSj3ztldnblfIH/jkFlnuHUQ+BApy8yzZ6Yn3 MkpB0Jwahpc4JtbpdMLkd56X3UCfmNYx5AQf1cK3Jdrtj4AC4AGM31K+FR+3du85tyyc QPFA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: APt69E1h1ZygQWj8OgOOFIveDKrXsd2Y6053EKNNBTmf/Aqu8vyrNGGn Pt6Z6Guk6XwZiLOPxL96y3ftWV/eRqWjS1OnKBS2xSs0vSNKNUjlgPYYtgVrVwT3ipIhQjsZjHY kh+Wkkw2NlxFkGXPT3ZqCK9NUoIkTErRC0CmpzKGEnf9RHzqB45AJCcxNBjQrYrosKw== X-Received: by 2002:aa7:810c:: with SMTP id b12-v6mr19529975pfi.79.1529442544329; Tue, 19 Jun 2018 14:09:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIF/J6e3SyEQPeduBBVNZVwY+M7nF1VrZ41VBwXlm5K0IRb+deuRxVJcnqA8QFe09SN0Y/1 X-Received: by 2002:aa7:810c:: with SMTP id b12-v6mr19529938pfi.79.1529442543524; Tue, 19 Jun 2018 14:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529442543; cv=none; d=google.com; s=arc-20160816; b=xfFhquyfdrvauFB7MnC356bixj0rEEKbjOgSH7DuQPaOgkDNcEZMyro6hXyeduTH1Q 76DLpNW+SzhEhSNkKS2enTE9RAa6M+WIi7xlU2ja99n+1vdFW3XNH4/hAA7GF6+kJ+Im ZP1mz6/zgQ1gosbFuMtJuRw6IOs6kSVh7ohVmMK4vPK7uhd78cL5iAqYUmVAHEX/oxF5 n/KASsSamcjh95gUCkFfoBA2Lep5eK8/0fvVtl4TnMzr99SxCKUTCcU13FEIkiMdgcc0 pUUHApovWrdTwyjRU4vYFhrtb9UI+ReNHp7Q/E/jJwX2LxYQvaZDAHA1b/gDNxNl17lB n5MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=O178fy/494JJ6MqBFh6T5/+wTFyihphrOdyqU6D6Ivk=; b=0YfMPZllSPyeMMv/9FJx9wgsS/t3o7rfPqzrg2rneO4EkSnuqjlyVCc234CN2pr7Ly w7vuXUFAenI35jU1vqPK4P05R/YwygmqUkU0dduo1rFG/N14ZLkPVL76MApgVwj3t8+p sOigS4RiDN0abm3oeZ/n3BwE/J0IHnJR9l7XJYJu2JPfpstzV4GUnMHhHbnY4/ai6nu5 etxsAuAs+IfSNCQ88GIweu1pcTKiQTMRus+LNMmtNWvaACVx6iVz4YHcAh+SEWvWlOGO nxwJMCvVKyz6mBjxgPX83l3PVYc58dpo7WiOXWehHz70+KTKKBP1HG7P/Dk0Ef2wX1nQ rM8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com. [115.124.30.132]) by mx.google.com with ESMTPS id m4-v6si495130pgp.512.2018.06.19.14.09.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jun 2018 14:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) client-ip=115.124.30.132; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R171e4; CH=green; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01f04446; MF=yang.shi@linux.alibaba.com; NM=1; PH=DS; RN=6; SR=0; TI=SMTPD_---0T3.ushs_1529442518; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T3.ushs_1529442518) by smtp.aliyun-inc.com(127.0.0.1); Wed, 20 Jun 2018 05:08:51 +0800 From: Yang Shi To: hughd@google.com, kirill.shutemov@linux.intel.com, akpm@linux-foundation.org Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] thp: use mm_file_counter to determine update which rss counter Date: Wed, 20 Jun 2018 05:08:38 +0800 Message-Id: <1529442518-17398-1-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 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: X-Virus-Scanned: ClamAV using ClamSMTP Since commit eca56ff906bdd0239485e8b47154a6e73dd9a2f3 ("mm, shmem: add internal shmem resident memory accounting"), MM_SHMEMPAGES is added to separate the shmem accounting from regular files. So, all shmem pages should be accounted to MM_SHMEMPAGES instead of MM_FILEPAGES. And, normal 4K shmem pages have been accounted to MM_SHMEMPAGES, so shmem thp pages should be not treated differently. Accouting them to MM_SHMEMPAGES via mm_counter_file() since shmem pages are swap backed to keep consistent with normal 4K shmem pages. This will not change the rss counter of processes since shmem pages are still a part of it. Signed-off-by: Yang Shi Cc: Hugh Dickins Cc: Kirill A. Shutemov Acked-by: Vlastimil Babka --- mm/huge_memory.c | 4 ++-- mm/memory.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 1cd7c1a..2687f7c 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1740,7 +1740,7 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, } else { if (arch_needs_pgtable_deposit()) zap_deposited_table(tlb->mm, pmd); - add_mm_counter(tlb->mm, MM_FILEPAGES, -HPAGE_PMD_NR); + add_mm_counter(tlb->mm, mm_counter_file(page), -HPAGE_PMD_NR); } spin_unlock(ptl); @@ -2088,7 +2088,7 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd, SetPageReferenced(page); page_remove_rmap(page, true); put_page(page); - add_mm_counter(mm, MM_FILEPAGES, -HPAGE_PMD_NR); + add_mm_counter(mm, mm_counter_file(page), -HPAGE_PMD_NR); return; } else if (is_huge_zero_pmd(*pmd)) { /* diff --git a/mm/memory.c b/mm/memory.c index 7206a63..4a2f2a8 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3372,7 +3372,7 @@ static int do_set_pmd(struct vm_fault *vmf, struct page *page) if (write) entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); - add_mm_counter(vma->vm_mm, MM_FILEPAGES, HPAGE_PMD_NR); + add_mm_counter(vma->vm_mm, mm_counter_file(page), HPAGE_PMD_NR); page_add_file_rmap(page, true); /* * deposit and withdraw with pmd lock held