[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTilVZpXlY294vzHS5gVf4f1M4fuz_vN17LOpoRxc@mail.gmail.com>
Date: Mon, 10 May 2010 20:24:49 +0800
From: wzt wzt <wzt.wzt@...il.com>
To: Jens Axboe <jens.axboe@...cle.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Block: Check major number before allocate the buffer in
register_blkdev()
the original code use kmalloc() to allocate struct blk_major_name
buffer first, then find the major number in major_names array. if
found it, it will kfree() the unused struct blk_major_name buffer,
if register_blkdev() called many times like:
register_blkdev(22, "aa");
....
register_blkdev(22, "aa");
kmalloc()/kfree() will be no need to invoked many times, my point is
that find the major number first, then allocate the buffer will be
better. this patch can handle the special case.
On Mon, May 10, 2010 at 7:56 PM, Jens Axboe <jens.axboe@...cle.com> wrote:
> On Mon, May 10 2010, wzt.wzt@...il.com wrote:
>> Check major number before allocate the buffer, if the major number is not exist,
>> and the register_blkdev() called many times, kmalloc()/kfree() will be no need
>> to invoked many times. So check the major number before use kmalloc() to allocate
>> the buffer will be better.
>
> This would generally be sound advice for performance oriented code, but
> I can't see it making any difference here.
>
> --
> Jens Axboe
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists