Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2934479ybx; Fri, 8 Nov 2019 11:29:28 -0800 (PST) X-Google-Smtp-Source: APXvYqyHtPuTD0k4MbWkvL6P1grJi1+KoheTkVJfQz6gCbwYOL8q6AQZ8rv2wjWZ59WGTwKREtJO X-Received: by 2002:a17:906:459:: with SMTP id e25mr10440076eja.259.1573241368822; Fri, 08 Nov 2019 11:29:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573241368; cv=none; d=google.com; s=arc-20160816; b=vMUTy7DOZ/snH3uCcrVYDE2pTllj39g4D2zgX8is8Nys6BHiCfyI5XCvPkO3L7hGnp uqHLZsqzQx23gtf4dpXCUxvfvRT15Lg33WmK7iU8OsZ5tGaYo32BOxBSHiKT3iD1v2md MwhenY62Y3eJumdPGL6oHp5O14zWAeOA+UhZfFZjOWK4gHdsDk1ABFEJ4FRkp45GeLAB f5QyCxL6zl8PrckKQ7/o9L3UDpcy/VTL01HfO7dyNqqZvvcUDYEzaeiUsHf3ta9cA6oy RIWUITVgD76sOYe1HMka9AZYVHzq+3Hwo/bvyI2kwSPwAmZT7+/StkU4MGOyy/hYsuMp 2S0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=CkJ8BjIClBalW4Y8w4jj3zANoh6LyH1bD+0n/0uxb4s=; b=xlnK6TPllNsxixxtgrSeFo2CbdPX440YSwm/bdM3uT+x8rEvdQzwXwhCUsh7c/oNZH cA3gAx0KloHp77guGLPGzqlJsJbZGX33cWxoUaU84Il7ygfQt2BZEgbgLtR4/rnougnP nlfS8bw2LmMnINws1ch2S3yUVIFsH3JRp+AVCu+o7iuWAXZGPCwu4mxisE0oC72VXps1 Q+DgK7oXFlAyLviN5wZJAfHI9EvcnzP3fniFbrzvJrVIICvesqrg+Kfb/aX0snRB5vZD mt33Q1Qz8qE1eGkiak0GI1Mr8XdSUDa6OIXD09orvdx4vQlhBiZc5DTq1Fhrx/vcZ0EY ePRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="DxvRK/XH"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t21si5127123edi.123.2019.11.08.11.29.05; Fri, 08 Nov 2019 11:29:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="DxvRK/XH"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731465AbfKHT0f (ORCPT + 99 others); Fri, 8 Nov 2019 14:26:35 -0500 Received: from mail-qk1-f201.google.com ([209.85.222.201]:39698 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726394AbfKHT0f (ORCPT ); Fri, 8 Nov 2019 14:26:35 -0500 Received: by mail-qk1-f201.google.com with SMTP id s3so7868254qkd.6 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=qjpuIm2NqnZDmXcQ2tUWHSVRFKCv8AWFlLZWh37UinTHhu6Lp0o/ASBgFuMrulMwl2 6yLqtXV+mZgfoE1GUS1rPRwgnYKT8rhbvVB/dOlg4mgaUxYEk5Hi9lG0sx8qBwtxermB kqDGZDtYZnNykRVwx/R54fogurx8YgXnPYVH5sP299jywZ2hfK/jI4MHGQNkyci5Tpr7 KZEaKiSEecq+RzTlUiTMjbMbDON1gJVkTqAUFBXj+PYz4E2s17zpGKDGJE5RrNEqbPAn BbBIA9aeKEPHIXLFE1oN+5qFaVgrsZpoZ8gbb8uH5hIwJ8mCLftmcZkbIAlCl1isLDfu 1HeA== X-Gm-Message-State: APjAAAUihi2hxrDYQFtHdCCxMOzK4Xfy0nZ7t12tsC1FJVOqRci4XFuU McdoJ5VuxSFALrEqO0PqxgsL/t54JiE= 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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