mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	 Muchun Song <muchun.song@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
	 David Rientjes <rientjes@google.com>,
	Alexei Starovoitov <ast@kernel.org>,
	 Pedro Falcato <pfalcato@suse.de>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH RFC 4/4] mm/slab: serialize defer_free_barrier()
Date: Tue, 3 Nov 2026 14:51:52 +0000	[thread overview]
Message-ID: <aun0lgIta8LmcP1T@thinkstation> (raw)
In-Reply-To: <feb3e339-f61d-4f99-9859-e1895d396561@kernel.org>

On Fri, Jun 26, 2026 at 05:00:51PM +0200, Vlastimil Babka (SUSE) wrote:
> On 6/24/26 15:11, Harry Yoo (Oracle) wrote:
> > irq_work_sync() uses rcuwait instead of busy waiting in two cases:
> > 
> >   1. The kernel is using PREEMPT_RT and the irq work does not run in a
> >      hardirq context.
> > 
> >   2. The architecture cannot send inter-processor interrupts to make
> >      busy waiting reasonably short.
> > 
> > However, rcuwait.h says:
> >> The caller is responsible for locking around rcuwait_wait_event(),
> >> and [prepare_to/finish]_rcuwait() such that writes to @task are
> >> properly serialized.
> > 
> > Since defer_free_barrier() calls irq_work_sync() without any locks,
> > it can potentially cause a hang as writes to @task are not serialized.
> > 
> > Fix this by calling defer_free_barrier() under slab_mutex and
> > cpus_read_lock() and add lockdep asserts.
> > 
> > Now that defer_free_barrier() is called inside cpus_read_lock(), iterate
> > over online cpus instead of possible cpus.
> > 
> > Reported-by: Sashiko <sashiko+bot@kernel.org>
> > Closes: https://sashiko.dev/#/patchset/20260615-kfree_rcu_nolock-v3-0-70a54f3775bb%40kernel.org?part=5
> > Fixes: af92793e52c3 ("slab: Introduce kmalloc_nolock() and kfree_nolock().")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Harry Yoo (Oracle) <harry@kernel.org>
> 
> Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>

It was dropped as it now introduces a mutex.

(codetag_unload_module() invokes kvfree_rcu_barrier() ->
deferred_work_barrier() but doesn't have access to slab_mutex
so we can't reuse it.)

-- 
Cheers,
Harry / Hyeonggon

  reply	other threads:[~2026-11-03 14:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 13:11 [PATCH RFC 0/4] memcg,slab: kmalloc_nolock() fixes Harry Yoo (Oracle)
2026-06-24 13:11 ` [PATCH RFC 1/4] mm/memcontrol: do not drain objcg stock when spinning is not allowed Harry Yoo (Oracle)
2026-06-26 14:30   ` Vlastimil Babka (SUSE)
2026-11-03 14:54     ` Harry Yoo
2026-06-24 13:11 ` [PATCH RFC 2/4] mm/slab: handle allow_spin in slab_free_hook() instead of open coding Harry Yoo (Oracle)
2026-06-26 14:41   ` Vlastimil Babka (SUSE)
2026-11-03 14:58     ` Harry Yoo
2026-06-24 13:11 ` [PATCH RFC 3/4] mm/slab: fix a deadlock in memcg_alloc_abort_single() Harry Yoo (Oracle)
2026-06-26 14:57   ` Vlastimil Babka (SUSE)
2026-06-24 13:11 ` [PATCH RFC 4/4] mm/slab: serialize defer_free_barrier() Harry Yoo (Oracle)
2026-06-26 15:00   ` Vlastimil Babka (SUSE)
2026-11-03 14:51     ` Harry Yoo [this message]
2026-06-24 16:30 ` [PATCH RFC 0/4] memcg,slab: kmalloc_nolock() fixes Alexei Starovoitov
2026-06-24 20:19   ` Harry Yoo
2026-06-26 15:09     ` Vlastimil Babka (SUSE)
2026-06-26  6:04 ` Harry Yoo
2026-06-26 15:10   ` Vlastimil Babka (SUSE)

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=aun0lgIta8LmcP1T@thinkstation \
    --to=harry@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=cl@gentwo.org \
    --cc=hannes@cmpxchg.org \
    --cc=hao.li@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=pfalcato@suse.de \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=vbabka@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

all inboxes | Powered by JetHome®