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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 289E3D2A523 for ; Wed, 16 Oct 2024 14:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=R6/JnoOaQl4y/L74bF1HW015d2yf2ALAwQ0YyqEqTTk=; b=ae9CC+YWfx645VnMfy7EvBi9JY IDjRf4nUXtICZM1echc2zpp0u4R+Epwx1owe3iiA+PpRt72MCnV7uYxa73sZOwExFPjNM2iuPozPY +a+Ry1I8X3kifsSIIlX6OLujlO2S53NzhEmE/CuaAfn03ewkCtPI8qRUPhXIqjliDhV+UZ/UZubZX a45NBM5xBSv130qAwqHvZfhpsg8fJ9DtWHqqCZaLcaLSl4tsYeUY0Koe6aULPMIie2k5YqcG/gvdG U43Zz4QWoju46O+m2MdITlOoaQjNRgqT5pFVTzSVfioy8IQgltovW2/R/Clp+bc2Wtlb21jBa0p+r x9bIcMzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t15Fz-0000000C7YA-21o0; Wed, 16 Oct 2024 14:44:11 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t15Ch-0000000C6XA-1S92 for linux-arm-kernel@lists.infradead.org; Wed, 16 Oct 2024 14:40:48 +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 758AFFEC; Wed, 16 Oct 2024 07:41:16 -0700 (PDT) Received: from [10.1.28.177] (XHFQ2J9959.cambridge.arm.com [10.1.28.177]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 848913F71E; Wed, 16 Oct 2024 07:40:43 -0700 (PDT) Message-ID: Date: Wed, 16 Oct 2024 15:40:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1 16/57] perf: Remove PAGE_SIZE compile-time constant assumption Content-Language: en-GB To: Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , David Hildenbrand , Greg Marsden , Ivan Ivanov , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Will Deacon , Arnaldo Carvalho de Melo , Ingo Molnar , Namhyung Kim , Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> <20241014105912.3207374-16-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: <20241014105912.3207374-16-ryan.roberts@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_074047_505536_F737ED8C X-CRM114-Status: GOOD ( 18.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org + Arnaldo Carvalho de Melo, Ingo Molnar, Namhyung Kim, Peter Zijlstra This was a rather tricky series to get the recipients correct for and my script did not realize that "supporter" was a pseudonym for "maintainer" so you were missed off the original post. Appologies! More context in cover letter: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ On 14/10/2024 11:58, Ryan Roberts wrote: > To prepare for supporting boot-time page size selection, refactor code > to remove assumptions about PAGE_SIZE being compile-time constant. Code > intended to be equivalent when compile-time page size is active. > > Refactor a BUILD_BUG_ON() so that we test against the limit; _format is > invariant to page size so testing it is no bigger than the minimum > supported size is sufficient. > > Wrap global variables that are initialized with PAGE_SIZE derived values > using DEFINE_GLOBAL_PAGE_SIZE_VAR() so their initialization can be > deferred for boot-time page size builds. > > Signed-off-by: Ryan Roberts > --- > > ***NOTE*** > Any confused maintainers may want to read the cover note here for context: > https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ > > include/linux/perf_event.h | 2 +- > kernel/events/core.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > index 1a8942277ddad..b7972155f93eb 100644 > --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -1872,7 +1872,7 @@ _name##_show(struct device *dev, \ > struct device_attribute *attr, \ > char *page) \ > { \ > - BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ > + BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE_MIN); \ > return sprintf(page, _format "\n"); \ > } \ > > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 8a6c6bbcd658a..81149663ab7d8 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -419,7 +419,7 @@ static struct kmem_cache *perf_event_cache; > int sysctl_perf_event_paranoid __read_mostly = 2; > > /* Minimum for 512 kiB + 1 user control page */ > -int sysctl_perf_event_mlock __read_mostly = 512 + (PAGE_SIZE / 1024); /* 'free' kiB per user */ > +__DEFINE_GLOBAL_PAGE_SIZE_VAR(int, sysctl_perf_event_mlock, __read_mostly, 512 + (PAGE_SIZE / 1024)); /* 'free' kiB per user */ > > /* > * max perf event sample rate