All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] blk-iocost: Use alloc_percpu_gfp() to simplify the code
Date: Wed, 16 Dec 2020 10:21:06 -0500	[thread overview]
Message-ID: <X9ol4gE65kD6qIyh@mtj.duckdns.org> (raw)
In-Reply-To: <33480f8a-89a3-3ed9-6fd0-95b2944ccbdd@linux.alibaba.com>

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

  reply	other threads:[~2020-12-16 15:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 10:56 [PATCH 1/2] blk-iocost: Add iocg idle state tracepoint Baolin Wang
2020-12-10 10:56 ` [PATCH 2/2] blk-iocost: Use alloc_percpu_gfp() to simplify the code Baolin Wang
2020-12-10 14:26   ` Tejun Heo
2020-12-11  7:13     ` Baolin Wang
2020-12-16 15:21       ` Tejun Heo [this message]
2020-12-17  7:53         ` Baolin Wang
2020-12-10 14:27 ` [PATCH 1/2] blk-iocost: Add iocg idle state tracepoint Tejun Heo
2020-12-17  7:57 ` Baolin Wang
2020-12-17 14:56   ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X9ol4gE65kD6qIyh@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.