Re: [PATCH v2 3/3] mm: change type of parameter for memory_notify

Israel Batista <[email protected]> Thu, 30 Oct 2025 11:16:00 +0000 (UTC)
Newsgroups org.kernel.vger.linux-debuggers,org.kvack.linux-mm
Message-ID <[email protected]>

On 10/30/25 07:56, Lorenzo Stoakes wrote:
> This seems fine, but I can see a whole bunch of others like:
> 
> kcore_callback()
> mm_compute_batch_notifier()
> page_ext_callback()
> reserve_mem_notiifer()
> etc.
> 
> So I think worth chasing all of these down?
> 

Yeah, I figured there were other cases and was originally planning to
include them in the patch series. The problem is they are notifier
callbacks and changing the type from unsingned long to enum
memory_block_state would break compatibility with the type notifier_fn_t
found in include/linux/notifier.h:

typedef	int (*notifier_fn_t)(struct notifier_block *nb,
			unsigned long action, void *data);

So I think it's not worth the trouble for now.

>
> Some of the switches which don't cover all cases will need to be adjusted to
> insert a no-op default:
> 

Good point.

>> -extern int memory_notify(unsigned long val, void *v);
>> +extern int memory_notify(enum memory_block_state state, void *v);
> 
> No reason you'd know, but we have a pattern of removing extraneous extern's like
> this when we otherwise change a line.
> 

Oh, that's good to know, I'll update it and keep that in mind for my
next patches.