Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756797AbcJSFLn (ORCPT ); Wed, 19 Oct 2016 01:11:43 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38421 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756614AbcJSFLa (ORCPT ); Wed, 19 Oct 2016 01:11:30 -0400 From: "Aneesh Kumar K.V" To: Andrew Morton Cc: Jan Stancek , Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] mm/hugetlb: Use the right pte val for compare in hugetlb_cow In-Reply-To: <20161018113341.e032f26c052dd63a8dca1f09@linux-foundation.org> References: <20161018154245.18023-1-aneesh.kumar@linux.vnet.ibm.com> <20161018113341.e032f26c052dd63a8dca1f09@linux-foundation.org> Date: Wed, 19 Oct 2016 10:41:19 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101905-0028-0000-0000-000005D753E3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005938; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000187; SDB=6.00770064; UDB=6.00369043; IPR=6.00546525; BA=6.00004818; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013037; XFM=3.00000011; UTC=2016-10-19 05:11:26 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101905-0029-0000-0000-00003025C949 Message-Id: <871szcsz2g.fsf@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-19_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610190091 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1688 Lines: 35 Andrew Morton writes: > On Tue, 18 Oct 2016 21:12:45 +0530 "Aneesh Kumar K.V" wrote: > >> We cannot use the pte value used in set_pte_at for pte_same comparison, >> because archs like ppc64, filter/add new pte flag in set_pte_at. Instead >> fetch the pte value inside hugetlb_cow. We are comparing pte value to >> make sure the pte didn't change since we dropped the page table lock. >> hugetlb_cow get called with page table lock held, and we can take a copy >> of the pte value before we drop the page table lock. >> >> With hugetlbfs, we optimize the MAP_PRIVATE write fault path with no >> previous mapping (huge_pte_none entries), by forcing a cow in the fault >> path. This avoid take an addition fault to covert a read-only mapping >> to read/write. Here we were comparing a recently instantiated pte (via >> set_pte_at) to the pte values from linux page table. As explained above >> on ppc64 such pte_same check returned wrong result, resulting in us >> taking an additional fault on ppc64. > > From my reading this is a minor performance improvement and a -stable > backport isn't needed. But it is unclear whether the impact warrants a > 4.9 merge. This patch workaround the issue reported at https://lkml.kernel.org/r/57FF7BB4.1070202@redhat.com The reason for that OOM was a reserve count accounting issue which happens in the error path of hugetlb_cow. Not this patch avoid us taking the error path and hence we don't have the reported OOM. An actual fix for that issue is being worked on by Mike Kravetz. > > Please be careful about describing end-user visible impacts when fixing > bugs, thanks. -aneesh