Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp996924pxb; Fri, 22 Jan 2021 04:50:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUj1tTEDyK49H/y6T9Z8ur1cUSl7VbfWM0OY93aqybQs+vwsTMSJLmk+U7fHYqtq8HHccC X-Received: by 2002:a05:6402:2346:: with SMTP id r6mr3174552eda.8.1611319818011; Fri, 22 Jan 2021 04:50:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611319818; cv=none; d=google.com; s=arc-20160816; b=m3MVAbUWiyTWTa2hPnrhJxM3Te7lsYUQAzs82Wse7eNFEsV2T01/U1KVfm9djq4NTt xOPNOPHB5acV/zUHHVpGncX9EpuOg/M9gDKDJRio15UHGYA1MYaRFGeO8sKZurzj6/YE 0h1W9sseWMlwwOy4shTavLu5DN+Y9IgbLPZczsgmr3Mb45X6ByjWQYQnr8lo1sr4fDwZ wQodu/yR0ub7oaPObN3bmqH8Y+HmAaN76uElHj0/ssYQSuqYcDXmYjD387Tp3icJBjDI VnKp4mYsx6RcKTrDI0uq4zBJbXPJFBkiKm6e8xsh7iwADfW5BD+5GbsYGZ/UNH1uMZqL PvSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=zcMEAfybPgMp2Kp4waPX3r4nV3qmQKfkZjxIgnJok6I=; b=ROf0ZLuPIJ4sXN67/2Sx+JhA7aDvKuK7uzBugHk6icct/+smWBGRD0VqG2QiHeZ7MQ zTih6aYdtk7vj+LTjjNIXMY80rIV7h0QGLWlPaaN+IeKJumvcKtpLaQBlZz4VHcZwoNO K1iyGX2PsBV3Yi+JM0E440VLLGkmBaA2I0IV/0/UA8TVb18w2/N+bpOQI7tu/QLaslhC b/So2u52x/7Y3lFjGBbxw2jsh1lb3NPpQGp4npUYgjr3xTWg8hhUld60GiDWGSqNTJj4 inFrJHDuZYIHwF613CpDrRH5MJML67LS/Kq/v048TsXGb4uEcJo4Wx4HwxSEp/Itvt8B sCvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx8si2914669ejb.664.2021.01.22.04.49.54; Fri, 22 Jan 2021 04:50:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726515AbhAVMrJ (ORCPT + 99 others); Fri, 22 Jan 2021 07:47:09 -0500 Received: from foss.arm.com ([217.140.110.172]:45938 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbhAVMqo (ORCPT ); Fri, 22 Jan 2021 07:46:44 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 53A9011D4; Fri, 22 Jan 2021 04:45:58 -0800 (PST) Received: from [10.57.39.58] (unknown [10.57.39.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4DF533F66E; Fri, 22 Jan 2021 04:45:56 -0800 (PST) Subject: Re: [PATCH 0/1] mm: Optimizing hugepage zeroing in arm64 To: Catalin Marinas Cc: Will Deacon , Prathu Baronia , Prathu Baronia , Anshuman Khandual , linux-kernel@vger.kernel.org, chintan.pandya@oneplus.com, "glider@google.com" , Andrey Konovalov , Geert Uytterhoeven , Andrew Morton , Vincenzo Frascino , linux-arm-kernel@lists.infradead.org References: <20210121165153.17828-1-prathu.baronia@oneplus.com> <20210121174616.GA22740@willie-the-truck> <20210122121334.GC8567@gaia> From: Robin Murphy Message-ID: Date: Fri, 22 Jan 2021 12:45:55 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210122121334.GC8567@gaia> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-01-22 12:13, Catalin Marinas wrote: > On Thu, Jan 21, 2021 at 06:59:37PM +0000, Robin Murphy wrote: >> On 2021-01-21 17:46, Will Deacon wrote: >>> On Thu, Jan 21, 2021 at 10:21:50PM +0530, Prathu Baronia wrote: >>>> This patch removes the unnecessary kmap calls in the hugepage zeroing path and >>>> improves the timing by 62%. >>>> >>>> I had proposed a similar change in Apr-May'20 timeframe in memory.c where I >>>> proposed to clear out a hugepage by directly calling a memset over the whole >>>> hugepage but got the opposition that the change was not architecturally neutral. >>>> >>>> Upon revisiting this now I see significant improvement by removing around 2k >>>> barrier calls from the zeroing path. So hereby I propose an arm64 specific >>>> definition of clear_user_highpage(). >>> >>> Given that barrier() is purely a thing for the compiler, wouldn't the same >>> change yield a benefit on any other architecture without HIGHMEM? In which >>> case, I think this sort of change belongs in the core code if it's actually >>> worthwhile. >> >> I would have thought it's more the constant manipulation of the preempt and >> pagefault counts, rather than the compiler barriers between them, that has >> the impact. Either way, if arm64 doesn't need to be atomic WRT preemption >> when clearing parts of hugepages then I also can't imagine that anyone else >> (at least for !HIGHMEM) would either. > > I thought the kmap_local stuff was supposed to fix this unnecessary > preemption disabling on 64-bit architectures: > > https://lwn.net/Articles/836144/ > > I guess it's not there yet. No, it's there alright - when I pulled up the code to double-check my memory of this area, I did notice the kerneldoc and start wondering if this should simply be using kmap_local_page() for everyone. Robin.