From mboxrd@z Thu Jan 1 00:00:00 1970 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=-17.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL 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 8112AC5DF60 for ; Fri, 8 Nov 2019 19:26:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2773520656 for ; Fri, 8 Nov 2019 19:26:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="DxvRK/XH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2773520656 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 886796B0003; Fri, 8 Nov 2019 14:26:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 810366B0006; Fri, 8 Nov 2019 14:26:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D8536B0007; Fri, 8 Nov 2019 14:26:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 53A466B0003 for ; Fri, 8 Nov 2019 14:26:35 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 20382180AD806 for ; Fri, 8 Nov 2019 19:26:35 +0000 (UTC) X-FDA: 76134091950.25.ants38_1c589c7adbc03 X-HE-Tag: ants38_1c589c7adbc03 X-Filterd-Recvd-Size: 4260 Received: from mail-qv1-f74.google.com (mail-qv1-f74.google.com [209.85.219.74]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 Nov 2019 19:26:34 +0000 (UTC) Received: by mail-qv1-f74.google.com with SMTP id b6so1428823qvo.4 for ; Fri, 08 Nov 2019 11:26:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=CkJ8BjIClBalW4Y8w4jj3zANoh6LyH1bD+0n/0uxb4s=; b=DxvRK/XHt9Ol7n7p5ISNiuBjXfbFXBOX5S8wdWgPBxQ7FEeX2sENsoymr4muRy1AVS bMIHbLqlBxqFtvFiQWhELfcdvUZF9qc80iNQLX5WhvuEmVaoNpy7zS0w6Cu0N+EzpzGx 72eZ+Q8t8olFKWQihVixJ0+T1pKyMuP9zjBIsUDqp1vTSKllBxz5uqHU9PN2O1BAlEPX N4auhyMbYhUFtqk+NOgz9UzzpgiMnmXrjOdmlTaqJfXOUYWtaHuD1ch1AsSaCbLG01LP IHKb1awqa0gnT7qIxphP8Lpgr1tyq6Fpee4bM65068IjxdrMUwp5RlgYwy1rLisCDg6D K72A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=CkJ8BjIClBalW4Y8w4jj3zANoh6LyH1bD+0n/0uxb4s=; b=HHJcint+se564C7nsZB21IWXMvV3gP69e37F3dJSKrMulgvxFU7LCF6notEb+PTc1m tUAy6xq7UHXAWrLT1gqvKYzt5I07r9pRII7A1wvNm78r5qqF3rsRPJvUtBtGh158xCDD dXvMkZSidenfsxMAhXs+i+mTji+fuzT1/fjH3+QVzlnq1ER8nOaOvwDOMmcfb65/DMVn i6ZGJjZBDPpVsSu+vBYlcrs5BwPUVe9zoftnNy7AI5nx1MNmC+6FRsbtA7jp5mERdYRy 3ciamWC0K+ECln4YWstFUZkeaw+KPcWZ/cfx20WT3K0QvpYa1DukH5Maz1Lg6+YHbccH 7qKw== X-Gm-Message-State: APjAAAXtNeOzl7CrvJWGX9DZqZahUiA/mhkRILOKLqxbWPIjtUZ98yAW OzluCj/Th3fdvb0naIDke63bvQPoxt0= X-Google-Smtp-Source: APXvYqysL+LzuTzAGpCWRV5hZJ/EIYvM6ZlPZycnNHVHeOUPhvj2NV66yrGjKf/4pBFV10bm6riOtOItdKw= X-Received: by 2002:a05:620a:12b7:: with SMTP id x23mr10132390qki.31.1573241193752; Fri, 08 Nov 2019 11:26:33 -0800 (PST) Date: Fri, 8 Nov 2019 12:26:29 -0700 In-Reply-To: <20190825200621.211494-1-yuzhao@google.com> Message-Id: <20191108192629.201556-1-yuzhao@google.com> Mime-Version: 1.0 References: <20190825200621.211494-1-yuzhao@google.com> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog Subject: [PATCH v2] mm: replace is_zero_pfn with is_huge_zero_pmd for thp From: Yu Zhao To: Andrew Morton Cc: Matthew Wilcox , Ralph Campbell , "=?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?=" , Will Deacon , Peter Zijlstra , "Aneesh Kumar K . V" , Dave Airlie , Thomas Hellstrom , Souptick Joarder , Gerald Schaefer , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao Content-Type: text/plain; charset="UTF-8" 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: For hugely mapped thp, we use is_huge_zero_pmd() to check if it's zero page or not. We do fill ptes with my_zero_pfn() when we split zero thp pmd, but this is not what we have in vm_normal_page_pmd() -- pmd_trans_huge_lock() makes sure of it. This is a trivial fix for /proc/pid/numa_maps, and AFAIK nobody complains about it. Gerald Schaefer asked: > Maybe the description could also mention the symptom of this bug? > I would assume that it affects anon/dirty accounting in gather_pte_stats(), > for huge mappings, if zero page mappings are not correctly recognized. I came across this while I was looking at the code, so I'm not aware of any symptom. Signed-off-by: Yu Zhao --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index b1ca51a079f2..cf209f84ce4a 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -654,7 +654,7 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, if (pmd_devmap(pmd)) return NULL; - if (is_zero_pfn(pfn)) + if (is_huge_zero_pmd(pmd)) return NULL; if (unlikely(pfn > highest_memmap_pfn)) return NULL; -- 2.24.0.rc1.363.gb1bccd3e3d-goog