Re: linux-next: manual merge of the slab tree with the rcu tree
Alice Ryhl <[email protected]> Fri, 31 Jul 2026 23:14:42 +0200
| Newsgroups | org.kernel.vger.linux-next,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAH5fLggke1Yvv8btJSMFr5tEquydvKev8_7G4gSO5MvoAJUE3A@mail.gmail.com> |
On Fri, Jul 31, 2026 at 10:07=E2=80=AFPM Boqun Feng <[email protected]> wrot= e: > > On Fri, Jul 31, 2026 at 09:56:44AM +0200, Miguel Ojeda wrote: > > On Thu, 30 Jul 2026 15:38:48 +0100 Mark Brown <[email protected]> wrot= e: > > > > > > Today's linux-next merge of the slab tree got a conflict in: > > > > > > mm/slab_common.c > > > > > > between commit: > > > > > > 736084507faa3 ("rcu: Rename struct rcu_gp_oldstate to rcu_gp_seq") > > > > > > from the rcu tree and commit: > > > > > > bdd0cc9f0ffc3 ("mm/slab: introduce struct kvfree_rcu_head for kvfre= e_rcu batching") > > > > > > from the slab tree. > > > > The slab one semantically conflicts as well with commit: > > > > e5e86df8b666 ("rust: poll: use kfree_rcu() for PollCondVar") > > > > from the char-misc tree: > > > > error[E0308]: mismatched types > > --> rust/kernel/sync/poll.rs:175:44 > > | > > 175 | unsafe { bindings::kvfree_call_rcu((*ptr).rcu.get()= , ptr.cast::<ffi::c_void>()) }; > > | ------------------------- ^^^^^^^^^^^^^^^^= expected `*mut kvfree_rcu_head`, found `*mut callback_head` > > | | > > | arguments to this function are incorrect > > | > > =3D note: expected raw pointer `*mut bindings::kvfree_rcu_hea= d` > > found raw pointer `*mut bindings::callback_head` > > note: function defined here > > --> rust/bindings/bindings_generated.rs:90407:12 > > | > > 90407 | pub fn kvfree_call_rcu(head: *mut kvfree_rcu_head, ptr:= *mut ffi::c_void); > > | ^^^^^^^^^^^^^^^ > > > > The C API was not meant to have a visible effect, but we don't use the > > `kvfree_rcu()` macro, so we notice the change. We can add a similar cas= t > > to the C side: > > > > diff --git a/rust/kernel/sync/poll.rs b/rust/kernel/sync/poll.rs > > index 684dfa242b1a..79d7e08215b0 100644 > > --- a/rust/kernel/sync/poll.rs > > +++ b/rust/kernel/sync/poll.rs > > @@ -172,6 +172,6 @@ fn drop(&mut self) { > > unsafe { bindings::__wake_up_pollfree((*ptr).inner.inner.w= ait_queue_head.get()) }; > > > > // SAFETY: This was allocated using `KBox::pin_init`, so i= t can be freed with `kvfree`. > > - unsafe { bindings::kvfree_call_rcu((*ptr).rcu.get(), ptr.c= ast::<ffi::c_void>()) }; > > + unsafe { bindings::kvfree_call_rcu((*ptr).rcu.get().cast()= , ptr.cast::<ffi::c_void>()) }; > > } > > } > > > > Clippy doesn't complain about the "unneeded" `cast()` under > > `CONFIG_KVFREE_RCU_BATCHED=3Dn`, so it should be fine. > > > > Cc: Alice Ryhl <[email protected]> > > Cc: Boqun Feng <[email protected]> > > Cc: Greg Kroah-Hartman <[email protected]> > > Cc: Harry Yoo (Oracle) <[email protected]> > > Cc: Vlastimil Babka (SUSE) <[email protected]> > > > > Cc Nathan & Bert because of: > > https://lore.kernel.org/rust-for-linux/20260731192522.GA1014697@a= x162/ > > I actually prefer Nathan's fix, since it's more explicit about the > kvfree_rcu_head requirement. Alice & Miguel, thoughts? I like Nathan's fix as well. Not sure if it needs to be done in the merge commit, or if we can apply it as a patch to char-misc despite the unknown CFG_*? Alice