Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4318476ybl; Mon, 26 Aug 2019 08:41:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKBfjk3e7rgF9URvhvEA/Ejn2KoLuXgRnmxB30Q+k1gP43VqpRiGXYrD3wi4MJTOMjL8Ij X-Received: by 2002:a63:3dcd:: with SMTP id k196mr17218928pga.45.1566834067690; Mon, 26 Aug 2019 08:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566834067; cv=none; d=google.com; s=arc-20160816; b=wdeSS/JFlGlgB0SO39fuEBzrxKC2gN6sO6Rs6dUM1619rMZSuKc5ebb1JWB1YGgu5G jLAP/vrtIaIBK3Nieg9NQBxkLZWtvBw1hthhMb1DUEjVHmg5UWJ/tim3cf9YEKW3S2Jj 6/f9goI5NcPIiu9wcfgYvGUU4V6a7+8RFmIIJ501xk6UalFoL7+yTGOoTwM6bEZXqua2 Vj7MNY7g92W1XtJyJ5XChz05W0XKyJA/t3fl5JtBHxeCw4QELH3XptKnHpcr8d+sEDCJ R7ql5mCT7o6Il0PvOBh/DTwwi7REqTUaoZp1KsR1iqdVqyPpMUyx05FyilOarSjQQk2+ P2EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:subject:cc:to:from:date; bh=TQ5rNga1CA4ITT0T30YwQBVHnLoBAdyCJtzIani9mLA=; b=NfhD9kq4Z1rifbwXsdGhsEVtmvnnFNmHrWLaXE7XzYw5wcIbqtcRIozMeo0GFIJNGy Cl4umRpXBxF+aLjgzY0KPUXZSWRAXE5q5Qn3wHkReLGEey7ENAJOVTpUGkoNlsS2HSdf ftZacRMYqJ3nldGA/fhFp+vZ3GZCFfnfVAcP3L9yLZWGZgLcmmRiui4I2iAyGq7VhLKE 2nU6hi+n5E8nHDFczhet/a3zcHRETr3Lnsfzh1VGdSxKn3gnnOgGuOtN0pKa+ujR/3t7 TmM4Cskb4wF7rpP6WJ/Y0UbrGK9v2Ql5iZS2p588aTxOdxA58Qg9/F+xjKS3EvFaljT+ e5zQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f37si9252047pgm.145.2019.08.26.08.40.52; Mon, 26 Aug 2019 08:41:07 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732869AbfHZPJu (ORCPT + 99 others); Mon, 26 Aug 2019 11:09:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:21774 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730995AbfHZPJo (ORCPT ); Mon, 26 Aug 2019 11:09:44 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7QF82MR073808 for ; Mon, 26 Aug 2019 11:09:43 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2umfadxpr9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 26 Aug 2019 11:09:43 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 26 Aug 2019 16:09:41 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 26 Aug 2019 16:09:37 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7QF9abA55836676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Aug 2019 15:09:36 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 307514C04A; Mon, 26 Aug 2019 15:09:36 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B69734C04E; Mon, 26 Aug 2019 15:09:35 +0000 (GMT) Received: from thinkpad (unknown [9.152.98.249]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 26 Aug 2019 15:09:35 +0000 (GMT) Date: Mon, 26 Aug 2019 17:09:34 +0200 From: Gerald Schaefer To: Matthew Wilcox Cc: Yu Zhao , Andrew Morton , Ralph Campbell , =?UTF-8?B?SsOpcsO0bWU=?= 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 In-Reply-To: <20190826131858.GB15933@bombadil.infradead.org> References: <20190825200621.211494-1-yuzhao@google.com> <20190826131858.GB15933@bombadil.infradead.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19082615-0028-0000-0000-0000039426E8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19082615-0029-0000-0000-000024565C3E Message-Id: <20190826170934.7c2f4340@thinkpad> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-26_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=982 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908260158 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regards, Gerald