Re: [PATCH 3/3] block: only allocate poll_stats if there's a user of them

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

 



On 11/23/21 11:50 AM, Christoph Hellwig wrote:
>> +	spin_lock_irq(&q->stats->lock);
>> +	if (q->poll_stat) {
>> +		spin_unlock_irq(&q->stats->lock);
>> +		kfree(poll_stat);
>> +		return true;
>> +	}
>> +	q->poll_stat = poll_stat;
>> +	spin_unlock_irq(&q->stats->lock);
> 
> If we'd use a cmpxchg to install the pointer we could keep the
> blk_queue_stats definition private.

How about we just move this alloc+enable logic into blk-stat.c instead?

-- 
Jens Axboe




[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