mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "rae l" <crquan@gmail.com>
To: "Kay Sievers" <kay.sievers@vrfy.org>
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: Thu, 20 Nov 2008 01:37:36 +0800	[thread overview]
Message-ID: <91b13c310811190937ob9eddal28ef0d69ed32445c@mail.gmail.com> (raw)
In-Reply-To: <ac3eb2510811190900k62b1333aj9816e462601b4d0c@mail.gmail.com>

On Thu, Nov 20, 2008 at 1:00 AM, Kay Sievers <kay.sievers@vrfy.org> wrote:
> 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.

I'm sure it does work, one another as:

*** drivers/net/iseries_veth.c:
veth_probe_one[1088]           if (0 != kobject_add(&port->kobject,
&dev->dev.kobj, "veth_port"))

>> 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.
And I have searched all places kobject_add called, only these two
places in block/blk-sysfs.c
and block/elevator.c have constant strings. So this patch is the whole
kobject_add constant string
optmization patch.

>
> Thanks,
> Kay

-- 
Cheng Renquan, Shenzhen, China
Fred Allen  - "An associate producer is the only guy in Hollywood who
will associate with a producer."

      reply	other threads:[~2008-11-19 17:37 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
2008-11-19 17:37       ` rae l [this message]

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=91b13c310811190937ob9eddal28ef0d69ed32445c@mail.gmail.com \
    --to=crquan@gmail.com \
    --cc=gregkh@suse.de \
    --cc=jens.axboe@oracle.com \
    --cc=kay.sievers@vrfy.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 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®