Re: linux-next: manual merge of the slab tree with the rcu tree
From: Vlastimil Babka (SUSE)
Date: Fri Jul 31 2026 - 08:59:44 EST
On 7/31/26 11:59, Vlastimil Babka (SUSE) wrote:
> On 7/31/26 09:56, Miguel Ojeda wrote:
>> On Thu, 30 Jul 2026 15:38:48 +0100 Mark Brown <broonie@xxxxxxxxxx> wrote:
>>>
>>> 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 kvfree_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
>> |
>> = note: expected raw pointer `*mut bindings::kvfree_rcu_head`
>> 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 cast
>> 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.wait_queue_head.get()) };
>>
>> // SAFETY: This was allocated using `KBox::pin_init`, so it can be freed with `kvfree`.
>> - unsafe { bindings::kvfree_call_rcu((*ptr).rcu.get(), ptr.cast::<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=n`, so it should be fine.
>
> Thanks! Should I thus amend bdd0cc9f0ffc3 ("mm/slab: introduce struct
> kvfree_rcu_head for kvfree_rcu batching") with this fixup or you'll do that
> in the char-misc tree?
I see, it has to be in char-misc which introduces that patched code, we
don't have it.
>> Cc: Alice Ryhl <aliceryhl@xxxxxxxxxx>
>> Cc: Boqun Feng <boqun@xxxxxxxxxx>
>> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>> Cc: Harry Yoo (Oracle) <harry@xxxxxxxxxx>
>> Cc: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
>>
>> Cheers,
>> Miguel
>