[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140314185320.GO18016@ZenIV.linux.org.uk>
Date: Fri, 14 Mar 2014 18:53:20 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Tejun Heo <tj@...nel.org>
Cc: linux-fsdevel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Stephen Tweedie <sct@...hat.com>,
Jeremy Eder <jeder@...hat.com>
Subject: Re: [PATCH 1/5][RFC][CFT] percpu fixes, part 1
On Fri, Mar 14, 2014 at 02:47:45PM -0400, Tejun Heo wrote:
> On Fri, Mar 14, 2014 at 06:45:45PM +0000, Al Viro wrote:
> > There's a missing piece in 2/3 (percpu: store offsets instead of lengths in
> > ->map[]) - we need to round size up to multiple of 2 in pcpu_alloc().
> > Updated patch follows; if you want an incremental instead of replacement -
> > please, yell.
>
> Yeah, I'd prefer an incremental patch. Also, can you please update
> the comment above alignment / size updates with a bit more detail?
>
> Thanks!
Done; incremental follows:
diff --git a/mm/percpu.c b/mm/percpu.c
index 5bb658a..65cab3b 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -713,11 +713,14 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
/*
* We want the lowest bit of offset available for in-use/free
- * indicator.
+ * indicator, so force >= 16bit alignment and make size even.
*/
if (unlikely(align < 2))
align = 2;
+ if (unlikely(size & 1))
+ size++;
+
if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
WARN(true, "illegal size (%zu) or align (%zu) for "
"percpu allocation\n", size, align);
--
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