[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BA44315.6030108@kernel.org>
Date: Sat, 20 Mar 2010 12:37:57 +0900
From: Tejun Heo <tj@...nel.org>
To: Yinghai Lu <yinghai@...nel.org>
CC: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Ian Campbell <Ian.Campbell@...rix.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...e.hu>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [LKML] Re: Infinite loop on boot in free_early_partial due to
start==end on tip/master
Hello,
On 03/20/2010 06:17 AM, Yinghai Lu wrote:
>> #ifdef CONFIG_NO_BOOTMEM
>> u64 start = __pa(ptr);
>> u64 end = start + size;
>> - free_early_partial(start, end);
>> + if (start< end)
>> + free_early_partial(start, end);
>
> it seems we could remove this line
>
> Tejun, how this could happen? free zero range ?
Well, the generic code assumes that the arch free callback can handle
zero length free, so on rare cases where the amount of used percpu
area in the first chunk equals the unit size, it happily call
free_fn() with zero length expecting the free function to ignore it.
Hmmm... well, given that it's a arch dependent callback and occurrence
of zero length free would be fairly rare, I think it would be better
to make the generic code avoid calling free with zero length.
Does the following patch fix the problem?
diff --git a/mm/percpu.c b/mm/percpu.c
index 768419d..d8d3f70 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1929,7 +1929,9 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, ssize_t dyn_size,
}
/* copy and return the unused part */
memcpy(ptr, __per_cpu_load, ai->static_size);
- free_fn(ptr + size_sum, ai->unit_size - size_sum);
+ if (ai->unit_size > size_sum)
+ free_fn(ptr + size_sum,
+ ai->unit_size - size_sum);
}
}
--
tejun
--
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