mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kay Sievers" <kay.sievers@vrfy.org>
To: "rae l" <crquan@gmail.com>
Cc: "Greg KH" <gregkh@suse.de>, "Jens Axboe" <jens.axboe@oracle.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kobject_add: use constant strings directly as fmt strings
Date: Wed, 19 Nov 2008 18:00:37 +0100	[thread overview]
Message-ID: <ac3eb2510811190900k62b1333aj9816e462601b4d0c@mail.gmail.com> (raw)
In-Reply-To: <91b13c310811190817s31522a0et744ca7df2782cf27@mail.gmail.com>

On Wed, Nov 19, 2008 at 17:17, rae l <crquan@gmail.com> wrote:
> On Wed, Nov 19, 2008 at 11:57 PM, Greg KH <gregkh@suse.de> wrote:
>>>       ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj),
>>> -                       "%s", "queue");
>>> +                       "queue");
>>
>> Why?  What does this change buy us?
>
> Dropping one parameter makes the function call a little faster, doesn't it?
>
> The results are the same,

Not that we should be able to measure it, but it should save some
cycles parsing the format character and retrieving the string pointer
from the stack, yes.

> so if the string is constant, why not use it directly as the fmt string?

It should be fine for strings, where you can be sure they can never
contain a '%', sure.

Thanks,
Kay

  reply	other threads:[~2008-11-19 17:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-19 15:54 crquan
2008-11-19 15:57 ` Greg KH
2008-11-19 16:17   ` rae l
2008-11-19 17:00     ` Kay Sievers [this message]
2008-11-19 17:37       ` rae l

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=ac3eb2510811190900k62b1333aj9816e462601b4d0c@mail.gmail.com \
    --to=kay.sievers@vrfy.org \
    --cc=crquan@gmail.com \
    --cc=gregkh@suse.de \
    --cc=jens.axboe@oracle.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®