From: Jens Axboe <axboe@kernel.dk>
To: Paolo Valente <paolo.valente@linaro.org>
Cc: linux-block <linux-block@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
broonie@kernel.org, linus.walleij@linaro.org,
lucmiccio@gmail.com, bfq-iosched@googlegroups.com
Subject: Re: [PATCH] block, bfq: remove batches of confusing ifdefs
Date: Sat, 2 Dec 2017 09:06:18 -0700 [thread overview]
Message-ID: <a64f4962-8736-75df-71ae-509342b0be8a@kernel.dk> (raw)
In-Reply-To: <5B4C446D-99EB-4698-B86A-5629AADA3D7B@linaro.org>
On 12/02/2017 03:04 AM, Paolo Valente wrote:
>
>> Il giorno 30 nov 2017, alle ore 22:21, Jens Axboe <axboe@kernel.dk> ha scritto:
>>
>> On 11/28/2017 02:37 AM, Paolo Valente wrote:
>>> Commit a33801e8b473 ("block, bfq: move debug blkio stats behind
>>> CONFIG_DEBUG_BLK_CGROUP") introduced two batches of confusing ifdefs:
>>> one reported in [1], plus a similar one in another function. This
>>> commit removes both batches, in the way suggested in [1].
>>
>> Some comments below.
>>
>>> +static inline void bfq_update_dispatch_stats(struct request *rq,
>>> + spinlock_t *queue_lock,
>>> + struct bfq_queue *in_serv_queue,
>>> + bool idle_timer_disabled)
>>> +{
>>
>> Don't pass in the queue lock. The normal convention is to pass in the
>> queue, thus making this:
>>
>> static void bfq_update_dispatch_stats(struct request_queue *q,
>> struct request *rq,
>> struct bfq_queue *in_serv_queue,
>> bool idle_timer_disabled)
>>
>
> Ok, thanks. One question, just to try to learn, if you have time and
> patience for a brief explanation. Was this convention originated by
> some rationale? My concern is that bfq_update_dispatch_stats works on
> no field of q but the lock, and this fact would have been made
> explicit by passing only that exact field.
When you just pass in a lock, nobody knows what that lock is without
looking at the caller. If you pass in the queue, it's apparent
what is being locked.
>> which also gets rid of the inline. In general, never inline anything.
>> The compiler should figure it out for you. This function is way too big
>> to inline, plus the cost of what it's doing completely dwarfes function
>> call overhead.
>>
>
> Actually, I did so because of Linus' suggestion in [1]: "So for
> example, the functions that can go away should obviously be inline
> functions so that you don't end up having the compiler generate the
> arguments and the call to an empty function body ..."
>
> Maybe I misinterpreted his suggestion, and he meant that the function
> should be designed in such a way to be (almost) certainly considered
> inline by the compiler?
You can do that for the empty version, don't do it for the non-empty
version. That will go away, the other one will not.
--
Jens Axboe
next prev parent reply other threads:[~2017-12-02 16:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 9:37 [PATCH] block, bfq: remove batches of confusing ifdefs Paolo Valente
2017-11-28 10:39 ` Ulf Hansson
2017-11-30 21:21 ` Jens Axboe
2017-12-02 10:04 ` Paolo Valente
2017-12-02 16:06 ` Jens Axboe [this message]
2017-12-02 17:22 ` Paolo Valente
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=a64f4962-8736-75df-71ae-509342b0be8a@kernel.dk \
--to=axboe@kernel.dk \
--cc=bfq-iosched@googlegroups.com \
--cc=broonie@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucmiccio@gmail.com \
--cc=paolo.valente@linaro.org \
--cc=ulf.hansson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox