lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 16 Dec 2020 10:21:06 -0500
From:   Tejun Heo <tj@...nel.org>
To:     Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc:     axboe@...nel.dk, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] blk-iocost: Use alloc_percpu_gfp() to simplify the
 code

Hello,

On Fri, Dec 11, 2020 at 03:13:29PM +0800, Baolin Wang wrote:
> 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.

* It's highly unlikely but theoretically possible that some arch might need
  more than raw value to implement local semantics.

* People might wanna add debug annotations which may require more than just
  the raw value.

> 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;

Yeah, the lines become blurry when all existing usages are fine with zeroing
and we do end up needing to clean up those when the need arises (e.g. we
used to zero some spinlocks too). It's just a better form to stick with
initializers when they are provided.

Thanks.

-- 
tejun

Powered by blists - more mailing lists