Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3544875pxb; Mon, 24 Jan 2022 11:53:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNxi6gm9rJ2jNqYzsgwvPbakCikQpwX0fxdgMp6kkmkQ6h9j6VajcAosr+gEWW0tgnSiyG X-Received: by 2002:a63:6a09:: with SMTP id f9mr12689297pgc.533.1643053995409; Mon, 24 Jan 2022 11:53:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643053995; cv=none; d=google.com; s=arc-20160816; b=kuI2teZjHWJCy09bbHyZdqkd8ynlxRebhOPfqUoeCMo3PTvyeKqLruFXxOPvjVhM70 E9K3mjhNDegAWVuTpml4F5VkymTgEjn5Z7pAp/vXYpf4QHghPobUdfJdp68AfNyCxUhO YpwmEu6GsBkOtxholhWQKn5XmNq/TRR8EkKcR1Pp2+zY2taOQSMrt4iVFKP+Nids9rSU HnitN3KN8Q0C+VlM52Mwrlc2VDcFEo9/XRUlsLEeM69as9nwF77o3skUd87j7pVR+2qN RevfU7wiTi7dTRFPz4ifuFLFqusDXwBhLwKL3/GyiISY1st0qf+4VofLtpsegZll987x 22Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8ZxSf7vRGmtmjPRVRuc/UAtt0g7lispoIvSffcp1Qyk=; b=cmEaipiVRvXlgqcfIpH3koKGIXO85fj60wO7lH0jsOTi+PWb7rXJLDCtLBABcPu0Te 2E7hpIPtxJ/dSdkdxnChtFhBh8vvFB5dRSt3266+z2JILfEhCCA+3YFnPG/jUVkr1vj4 Ltv5xyUtGq4cd4iploXOfo7d0eymbHXRJjU9pWL7bd1UhVX2dX/encyhRIe+ds5LUVuN SGw+jMc4pkQFGG1bf3Rklw3lMi/zk77/mbS7EJ5A0z8lPjXPpYWII3Ep2C7k0hK3LKbb 0UKuNX1lxNvGP410DA5cbDQHUrhKOzfP6fPLTuJ+7Zfc31ATJz8atYDm3B9AdsH2ecAl KAFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=g6yrZ37h; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m16si7025407pgu.404.2022.01.24.11.53.03; Mon, 24 Jan 2022 11:53:15 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=g6yrZ37h; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245250AbiAXSbs (ORCPT + 99 others); Mon, 24 Jan 2022 13:31:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235727AbiAXSbr (ORCPT ); Mon, 24 Jan 2022 13:31:47 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22E97C06173B for ; Mon, 24 Jan 2022 10:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8ZxSf7vRGmtmjPRVRuc/UAtt0g7lispoIvSffcp1Qyk=; b=g6yrZ37hc7PRrLe90OF1G9oYOT 5dOCrI/gA/wzT/K15vRfpSwCqD1iRC10W4iuptigIekHQWhPfOktVNreow1Dq20yJEmQkIWgC6JhV YhpVPX1SU1+k8QPzh05WdnlpyD6H0/n9EjArlOvcwTnPUVL9hVBPivaiIgJnZlBj9n6JE1B+basIC tSyVzTf2zn6XwgIHtI5u8NB7CRqKR3FX7dBseDx74wr/qmQWxJYNea5eF0q00IDnk/sOwQGc1GvZ7 lyy+CKiMGen5ZSGss9V/Bk8jWm55T5xXDO4TjUEnQ8/m3awaoICONB9FTpOUMI5oNpgqB1zd9YSNn ukSyu7hg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nC47v-001452-K9; Mon, 24 Jan 2022 18:31:39 +0000 Date: Mon, 24 Jan 2022 18:31:39 +0000 From: Matthew Wilcox To: Ard Biesheuvel Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: make 'highmem' symbol ro_after_init Message-ID: References: <20220124170555.1054480-1-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220124170555.1054480-1-ardb@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 06:05:55PM +0100, Ard Biesheuvel wrote: > The 'highmem' variable is only set at boot, so we can make it > ro_after_init and prevent it from being corrupted inadvertently, or from > ending up in a contended cacheline. I'm not against this patch, but it'd be nice to go further and remove it entirely for !CONFIG_HIGHMEM builds? Adding something like static inline bool is_high_pfn(unsigned long pfn) { #ifdef CONFIG_HIGHMEM return pfn <= max_low_pfn; #else return false; #endif } static inline bool is_high_phys(phys_addr_t pa) { return is_high_pfn(pa / PAGE_SIZE); } static inline bool is_high_addr(void *addr) { return is_high_phys(virt_to_phys(addr)); } should be all the primitives you need, from a quick grep. > Signed-off-by: Ard Biesheuvel > --- > mm/memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memory.c b/mm/memory.c > index c125c4969913..50e82cb94ccc 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -106,7 +106,7 @@ EXPORT_SYMBOL(mem_map); > * highstart_pfn must be the same; there must be no gap between ZONE_NORMAL > * and ZONE_HIGHMEM. > */ > -void *high_memory; > +void *high_memory __ro_after_init; > EXPORT_SYMBOL(high_memory); > > /* > -- > 2.30.2 > >