[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130108152918.GA304@yliu-dev.sh.intel.com>
Date: Tue, 8 Jan 2013 23:29:18 +0800
From: Yuanhan Liu <yuanhan.liu@...ux.intel.com>
To: Ulrich Windl <Ulrich.Windl@...uni-regensburg.de>
Cc: linux-kernel@...r.kernel.org, Mike Christie <michaelc@...wisc.edu>,
iscsi list <open-iscsi@...glegroups.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"James E.J. Bottomley" <JBottomley@...allels.com>,
Stefani Seibold <stefani@...bold.net>
Subject: Re: Antw: [PATCH 0/5] kfifo cleanup and log based kfifo API
On Tue, Jan 08, 2013 at 04:03:17PM +0100, Ulrich Windl wrote:
> >>> Yuanhan Liu <yuanhan.liu@...ux.intel.com> schrieb am 08.01.2013 um 15:57 in
> Nachricht <1357657073-27352-1-git-send-email-yuanhan.liu@...ux.intel.com>:
>
> [...]
> > My proposal is to replace kfifo_init with kfifo_alloc, where it
> > allocate buffer and maintain fifo size inside kfifo. Then we can
> > remove buggy kfifo_init.
> [...]
>
> Spontaneously I feel that emitting a critical message if the requested size is not a power of two would be a good idea,
Hi Ulrich,
If we can emit all such critical message at compile time, it would
be good then. But we can't, as fifo size is runtime determinated in
quite many cases.
> as well as (in that case) rounding up to the next power of two instead of rounding down seems not too stupid ;-)
There are 2 issues, first, you just can't round the fifo size up to
power of 2 for kfifo_init as fifo buffer is allocated outside. And if
you do, you may access memory outside the buffer.
Second, round up to power of 2 inside kfifo_alloc and DECLARE_KFIFO is
simple and should work. But it wastes memory(by allocating more memory)
without notifing caller.
So, per discussed with Stefani, we better to change the API be log aware
to root fix this kind of potential issue.
Thanks.
--yliu
--
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