From: Ozgur Kara <ozgur@goosey.org>
To: Jeongjun Park <aha310510@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
urezki@gmail.com, edumazet@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] mm/vmalloc: fix data race in show_numa_info()
Date: Thu, 8 May 2025 07:56:00 +0000 [thread overview]
Message-ID: <01100196aee4edec-7bb15b82-c37f-4a2b-a7df-dfbbb2e9e6e0-000000@eu-north-1.amazonses.com> (raw)
In-Reply-To: <CAO9qdTEL1xhBOXbSR4KHgmh0vpEeiia5ii9Ae959ahFHLVycRQ@mail.gmail.com>
Jeongjun Park <aha310510@gmail.com>, 8 May 2025 Per, 07:47 tarihinde şunu yazdı:
>
> Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > On Wed, 7 May 2025 23:25:52 +0900 Jeongjun Park <aha310510@gmail.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
>
>
>
next prev parent reply other threads:[~2025-05-08 7:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 14:25 Jeongjun Park
2025-05-07 22:33 ` Andrew Morton
2025-05-08 4:47 ` Jeongjun Park
2025-05-08 7:56 ` Ozgur Kara [this message]
2025-05-07 22:50 ` Ozgur Kara
[not found] ` <01100196acf1ede5-ae116361-04f2-4e8f-b7a4-7079d6158ffb-000000@eu-north-1.amazonses.com>
2025-05-08 5:04 ` Jeongjun Park
2025-05-08 6:18 ` Jeongjun Park
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=01100196aee4edec-7bb15b82-c37f-4a2b-a7df-dfbbb2e9e6e0-000000@eu-north-1.amazonses.com \
--to=ozgur@goosey.org \
--cc=aha310510@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=urezki@gmail.com \
/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