public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [LKML] Re: Infinite loop on boot in free_early_partial due to start==end on tip/master
Date: Sat, 20 Mar 2010 12:37:57 +0900	[thread overview]
Message-ID: <4BA44315.6030108@kernel.org> (raw)
In-Reply-To: <4BA3E9CD.70203@kernel.org>

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

      parent reply	other threads:[~2010-03-20  7:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-05 15:03 Infinite loop on boot in free_early_partial due to start==end on tip/master Ian Campbell
2010-03-05 18:16 ` Yinghai Lu
2010-03-05 19:45   ` Ian Campbell
2010-03-05 19:49   ` [PATCH] x86: do not free zero sized per cpu areas Ian Campbell
2010-03-05 19:51     ` Yinghai Lu
2010-03-19 19:24   ` Yinghai Lu
2010-03-19 21:42     ` H. Peter Anvin
2010-03-19 22:18   ` [PATCH -v3] " Yinghai Lu
2010-03-19 22:21     ` H. Peter Anvin
2010-03-19 23:24       ` Yinghai Lu
2010-03-19 23:29         ` H. Peter Anvin
2010-03-19 23:45           ` [PATCH -v4] " Yinghai Lu
2010-03-20  1:00             ` Linus Torvalds
2010-03-20  1:59               ` [PATCH -v5] " Yinghai Lu
2010-03-20  2:41                 ` Linus Torvalds
2010-03-20  6:38                   ` [PATCH -v6] " Yinghai Lu
2010-03-20  7:12                     ` Ian Campbell
2010-03-22 17:30                     ` [LKML] " Konrad Rzeszutek Wilk
2010-03-19 23:35         ` [PATCH -v3] " Ian Campbell
2010-03-19 23:43           ` Ian Campbell
2010-03-19 23:43           ` H. Peter Anvin
2010-03-19 18:28 ` Infinite loop on boot in free_early_partial due to start==end on tip/master Konrad Rzeszutek Wilk
2010-03-19 19:04   ` Yinghai Lu
2010-03-19 19:34     ` Ian Campbell
2010-03-19 20:04       ` [LKML] " Konrad Rzeszutek Wilk
2010-03-19 21:17         ` Yinghai Lu
2010-03-19 21:37           ` Ian Campbell
2010-03-20  3:37           ` Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA44315.6030108@kernel.org \
    --to=tj@kernel.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox