linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Mike Rapoport <rppt@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: make 'highmem' symbol ro_after_init
Date: Fri, 28 Jan 2022 10:07:54 +0100	[thread overview]
Message-ID: <CAMj1kXHrS-=5Lc7rFz9Jaq8Nshss+VDgoP6n95D+w+1WB3OZEQ@mail.gmail.com> (raw)
In-Reply-To: <YfG/Wi5OBHeDRPdg@kernel.org>

On Wed, 26 Jan 2022 at 22:38, Mike Rapoport <rppt@kernel.org> wrote:
>
> 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.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>
> Acked-by: Mike Rapoport <rppt@linux.ibm.com>
>
> > ---
> >  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
> >
> >
>


This turns out to break CONFIG_MEMORY_HOTPLUG on x86, as it updates
max_pfn, max_low_pfn and high_memory after init.

So probably best to make all of those __read_mostly instead.


      reply	other threads:[~2022-01-28  9:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 17:05 Ard Biesheuvel
2022-01-24 18:17 ` David Rientjes
2022-01-24 18:31 ` Matthew Wilcox
2022-01-26 21:38 ` Mike Rapoport
2022-01-28  9:07   ` Ard Biesheuvel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMj1kXHrS-=5Lc7rFz9Jaq8Nshss+VDgoP6n95D+w+1WB3OZEQ@mail.gmail.com' \
    --to=ardb@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox