Re: [PATCH] blk-mq: use cpumap_print_to_pagebuf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/15/2016 04:07 PM, Jeff Moyer wrote:
> Hannes Reinecke <hare@xxxxxxx> writes:
> 
>> Use standard cpumap_print_to_pagebuf() instead of
>> hand-crafted function when displaying the cpu map.
>>
>> Signed-off-by: Hannes Reinecke <hare@xxxxxxxx>
>> ---
>>  block/blk-mq-sysfs.c | 15 +--------------
>>  1 file changed, 1 insertion(+), 14 deletions(-)
>>
>> diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
>> index 1cf1878..f817561 100644
>> --- a/block/blk-mq-sysfs.c
>> +++ b/block/blk-mq-sysfs.c
>> @@ -231,20 +231,7 @@ static ssize_t blk_mq_hw_sysfs_active_show(struct blk_mq_hw_ctx *hctx, char *pag
>>  
>>  static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
>>  {
>> -	unsigned int i, first = 1;
>> -	ssize_t ret = 0;
>> -
>> -	for_each_cpu(i, hctx->cpumask) {
>> -		if (first)
>> -			ret += sprintf(ret + page, "%u", i);
>> -		else
>> -			ret += sprintf(ret + page, ", %u", i);
>> -
>> -		first = 0;
>> -	}
>> -
>> -	ret += sprintf(ret + page, "\n");
>> -	return ret;
>> +	return cpumap_print_to_pagebuf(true, page, hctx->cpumask);
>>  }
> 
> You've just changed the output format[1] (and you didn't mention that in
> your patch description).  I don't think this change is worth potentially
> breaking existing scripts.
> 
> Cheers,
> Jeff
> 
> [1]
> Before:
> 
> # cat /sys/block/rssda/mq/0/cpu_list 
> 0, 1, 2, 3
> 
> After:
> 
> # cat /sys/block/rssda/mq/0/cpu_list 
> 0-3
> 
But this was precisely the point.

The smp_affinity is using the above function, making it _really_
hard to check if both settings match.
When using the same function the output is identical, and we can
just punt the output into smp_affinity.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@xxxxxxx			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux