[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <01100196aee4ede3-0997795d-f545-4c3d-9d05-5f8a955561ca-000000@eu-north-1.amazonses.com>
Date: Thu, 8 May 2025 07:56:00 +0000
From: Ozgur Kara <ozgur@...sey.org>
To: Jeongjun Park <aha310510@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, urezki@...il.com,
edumazet@...gle.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] mm/vmalloc: fix data race in show_numa_info()
Jeongjun Park <aha310510@...il.com>, 8 May 2025 Per, 07:47 tarihinde şunu yazdı:
>
> Andrew Morton <akpm@...ux-foundation.org> wrote:
> >
> > On Wed, 7 May 2025 23:25:52 +0900 Jeongjun Park <aha310510@...il.com> wrote:
> >
> > > The following data-race was found in show_numa_info():
> > >
> > > ...
> > >
> > >
> > > According to this report, there is a read/write data-race because m->private
> > > is accessible to multiple CPUs. To fix this, instead of allocating the heap
> > > in proc_vmalloc_init() and passing the heap address to m->private,
> > > show_numa_info() should allocate the heap.
> > >
> > > One thing to note is that show_numa_info() is called in a critical section
> > > of a spinlock, so it must be allocated on the heap with GFP_ATOMIC flag.
> >
> > GFP_ATOMIC is unfortunate. Can vmalloc_info_show() allocate the
> > storage outside the lock and pass that pointer into show_numa_info()?
> > That way will be more efficient also, less allocating and freeing.
> >
> >
>
> That's good idea! Definitely, if you modify vmalloc_info_show() to
> allocate the heap before taking the spinlock and initialize the heap
> to 0 at the beginning of the loop, we don't need to use GFP_ATOMIC,
> and we only need to allocate the heap once, which is much more efficient.
>
> I'll send you v4 patch that reflects this right away.
>
Hello,
I think so but i'm not sure if it will work because i just thought of
it as an idea because we need to check if v is null or not.
Regards,
Ozgur
> Regards,
>
> Jeongjun Park
>
>
>
Powered by blists - more mailing lists