Re: [PATCH] kobject_add: use constant strings directly as fmt strings

From: rae l
Date: Wed Nov 19 2008 - 12:37:49 EST


On Thu, Nov 20, 2008 at 1:00 AM, Kay Sievers <kay.sievers@xxxxxxxx> 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."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/