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=-12.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=no 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 7BF6AC3A5A9 for ; Wed, 4 Sep 2019 20:54:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 511692087E for ; Wed, 4 Sep 2019 20:54:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lL5TlUCt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730343AbfIDUyt (ORCPT ); Wed, 4 Sep 2019 16:54:49 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:42260 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726495AbfIDUyt (ORCPT ); Wed, 4 Sep 2019 16:54:49 -0400 Received: by mail-io1-f65.google.com with SMTP id n197so45572489iod.9 for ; Wed, 04 Sep 2019 13:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vXwoIRD/HomfAGA3enlPIWun5YO8zmnB2AFzW0Iniws=; b=lL5TlUCtshbicXBX7o8SDAZtZAKYXC6ca2f5A9ldF6R14qEtWGy99KueQps418Znq9 nw1RLiYAkb29C6Cfvhf3pDnBrnOMftTxL0cYvm/oCqZOub6VMXqVfVa2aWTgjSr4r4gj 8MPzqz7MtWfwJUNQo6KkZ7T76dRaxG/HeGS4IoscFtXW3YiOUivL81MJNqyOmTtrXfBt FEP+y4hCVNmDxZ1WzytKXQkbjsItc+aiZlQ5r32sAp8B+XE3wc1ogHHQaB3hdPCP7KzD fF+6ITHH/T4LiOKChbaM11LaRBRmjfa66V0sB+gCbPI1l5aDRVuBbn6GWlOoZa6zD2tK SenA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vXwoIRD/HomfAGA3enlPIWun5YO8zmnB2AFzW0Iniws=; b=RXAjNAdiPbFL8QD6WaAYZXS/dBDiaxRSZcV4DJ5ZOAuigKpEAuz1l30EvH0fyLuUuI u5lM9j5UKmf2L1nLZfIUCvQiahzEwH2zQQPT4DWF9Frpp6Ici5eGLg7spK3v0yZhRL3N e5fHo6YtYU1Ya+ZZ9egnfIVSUBW0qU9lVAkhDR3dlQ+uKWtqmqfOaKPnye5eY6SnCANw PUREhW6VUFKc3cheOurItLxdCZr/vBGCWU73flmkiYUDB55yxkfEwwjqVCkPDfWml4no lIv3NKVks1PmsywoQV+NH5hSmM2yZKnjmSbfHhDikqzWfkUc69lZZF60xC9tKrH5qCAs vflA== X-Gm-Message-State: APjAAAUMe3hvC+XDKOo/DoD1V5Idg7NTZ0g83YG9Ute0Oz6yyDFXshH/ 4QFf+ZP/9xQZ+ysMr/5ZBtfsxw== X-Google-Smtp-Source: APXvYqw87BnjWR9GdN8CRA7xMoVsDrp0wOKoOFPjmTBeJqSfmuF9wzp9tZO06jjNNw9zgpEiqOgfrA== X-Received: by 2002:a5e:9813:: with SMTP id s19mr2214175ioj.263.1567630488336; Wed, 04 Sep 2019 13:54:48 -0700 (PDT) Received: from google.com ([2620:15c:183:0:9f3b:444a:4649:ca05]) by smtp.gmail.com with ESMTPSA id j26sm36426ioe.18.2019.09.04.13.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 13:54:47 -0700 (PDT) Date: Wed, 4 Sep 2019 14:54:43 -0600 From: Yu Zhao To: Gerald Schaefer Cc: Matthew Wilcox , Andrew Morton , Ralph Campbell , =?iso-8859-1?B?Suly9G1l?= Glisse , Will Deacon , Peter Zijlstra , "Aneesh Kumar K . V" , Dave Airlie , Thomas Hellstrom , Souptick Joarder , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: replace is_zero_pfn with is_huge_zero_pmd for thp Message-ID: <20190904205443.GA70057@google.com> References: <20190825200621.211494-1-yuzhao@google.com> <20190826131858.GB15933@bombadil.infradead.org> <20190826170934.7c2f4340@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190826170934.7c2f4340@thinkpad> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 26, 2019 at 05:09:34PM +0200, Gerald Schaefer wrote: > On Mon, 26 Aug 2019 06:18:58 -0700 > Matthew Wilcox wrote: > > > Why did you not cc Gerald who wrote the patch? You can't just > > run get_maintainers.pl and call it good. > > > > On Sun, Aug 25, 2019 at 02:06:21PM -0600, Yu Zhao wrote: > > > 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. > > > > > > 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 e2bb51b6242e..ea3c74855b23 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.23.0.187.g17f5b7556c-goog > > > > > Looks good to me. The "_pmd" versions for can_gather_numa_stats() and > vm_normal_page() were introduced to avoid using pte_present/dirty() on > pmds, which is not affected by this patch. > > In fact, for vm_normal_page_pmd() I basically copied most of the code > from vm_normal_page(), including the is_zero_pfn(pfn) check, which does > look wrong to me now. Using is_huge_zero_pmd() should be correct. > > 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. Hi, sorry for not copying you on the original email. I came across this while I was looking at the code. I'm not aware of any symptom. Thank you.