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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 25044C433DB for ; Fri, 22 Jan 2021 12:47:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D51AF2343E for ; Fri, 22 Jan 2021 12:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727450AbhAVMra (ORCPT ); Fri, 22 Jan 2021 07:47:30 -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. 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=-5.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 EF70DC433E0 for ; Fri, 22 Jan 2021 12:47:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 888CD230FC for ; Fri, 22 Jan 2021 12:47:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 888CD230FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0SSsbu2ROun4ACxL+35hZN6q1aLBKDxfYAsHlg5xnYg=; b=QLwjqbf1cUnM4nub6q4mxJnhG DelCKnRmBPuzJjLLg36rLau5c20BWLEC3ecVorFThqhfUzFPt9fMDjtTXGctLu6gEbu/N7MU4yyM4 dzlS8Hmb7N1DefoyyW7kJ6+k/7H+3mIYvjibwsDUkRgPY1QPpleb7iGYloClhkoJQwe9jH40SU4eX Ar0j+h3KWRWUf9RSK7vvkbodw2bQwBFJpVvO95eGFPvUssW7eCCPxfBfCjXMz65qTrRG7iyXoIjrj Y3MNLbbs6gYHE/KrIs9ui21hQ56JgRRCqaikGuJG3crGx+3IkvHY0qe78Og/VerXFE5u6QKsG1G/K ZHhiRGheQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2vpF-00066D-9L; Fri, 22 Jan 2021 12:46:05 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2vpC-00065U-Gd for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 12:46:03 +0000 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 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-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_074602_617197_E4897572 X-CRM114-Status: GOOD ( 19.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anshuman Khandual , Andrey Konovalov , Prathu Baronia , linux-kernel@vger.kernel.org, Prathu Baronia , chintan.pandya@oneplus.com, "glider@google.com" , Geert Uytterhoeven , Andrew Morton , Vincenzo Frascino , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel