Re: [PATCH 2/2] SUNRPC: Check svc pool percpu counter allocation

"Chuck Lever" <[email protected]>
Newsgroups gmane.linux.nfs
Message-ID <[email protected]>

On Sat, May 30, 2026, at 5:45 PM, Jeff Layton wrote:
> On Sat, 2026-05-30 at 16:21 -0400, Chuck Lever wrote:

>> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
>> index ae9ec4bf34f7..aeb6e631848c 100644
>> --- a/net/sunrpc/svc.c
>> +++ b/net/sunrpc/svc.c
>> @@ -476,6 +476,22 @@ __svc_init_bc(struct svc_serv *serv)
>>  }
>>  #endif
>>  
>> +enum {
>> +	SVC_POOL_COUNTERS = 3,
>> +};
>> +
>> +static int svc_pool_init_counters(struct svc_pool *pool)
>> +{
>> +	return percpu_counter_init_many(&pool->sp_messages_arrived, 0,
>> +					GFP_KERNEL, SVC_POOL_COUNTERS);
>> +}
>> 
>> 
>
> Switching to this looks like a good thing, but it means that the
> svc_pool struct fields now have some strict ordering requirements. The
> percpu_counters all need to be snuggled up together.
>
> That deserves a comment to that effect in the struct svc_pool, so that
> we don't inadvertently break it later.

A comment or a static_assert


-- 
Chuck Lever
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.