On Thu, Jul 23, 2026 at 10:25:53AM +0200, Petr Pavlu wrote:
> The kmod dups code preallocates kmod_dup_req before taking kmod_dup_mutex
> to avoid allocating memory while holding the lock. This provides little
> benefit, since the allocation is fast and can safely be done under the
> lock. On the other hand, it leads to unnecessary allocations when the
> request turns out to be a duplicate and slightly complicates the code.
> 
> Allocate kmod_dup_req only when needed and introduce a helper function
> alloc_kmod_req() to initialize the structure.
> 
> Signed-off-by: Petr Pavlu <[email protected]>
> ---
>  kernel/module/dups.c | 38 ++++++++++++++++++++++----------------
>  1 file changed, 22 insertions(+), 16 deletions(-)

Reviewed-by: Aaron Tomlin <[email protected]>

-- 
Aaron Tomlin

Reply via email to