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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to