Re: [PATCH 2/2] blk-iocost: Use alloc_percpu_gfp() to simplify the code

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

 



Hi Tejun,

Hello,

On Thu, Dec 10, 2020 at 06:56:45PM +0800, Baolin Wang wrote:
Use alloc_percpu_gfp() with __GFP_ZERO flag, which can remove
some explicit initialization code.

__GFP_ZERO is implicit for percpu allocations and local[64]_t's initial
states aren't guaranteed to be all zeros on different archs.

Thanks for teaching me this, at least I did not get this from the local_ops Documentation before. Just out of curiosity, these local[64]_t variables are also allocated from budy allocator ultimately, why they can not be initialized to zeros on some ARCHs with __GFP_ZERO? Could you elaborate on about this restriction? Thanks.

By the way, seems the kyber-iosched has the same issue, since the 'struct kyber_cpu_latency' also contains an atomic_t variable.

	kqd->cpu_latency = alloc_percpu_gfp(struct kyber_cpu_latency,
					    GFP_KERNEL | __GFP_ZERO);
	if (!kqd->cpu_latency)
		goto err_kqd;




[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