All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hiroyuki KAMEZAWA <kamezawa.hiroyu@jp.fujitsu.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: Linux Kernel ML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	lhms <lhms-devel@lists.sourceforge.net>
Subject: Re: [Lhms-devel] Re: [RFC] buddy allocator without bitmap(2) [1/3]
Date: Wed, 01 Sep 2004 08:36:25 +0900	[thread overview]
Message-ID: <41350B79.1070305@jp.fujitsu.com> (raw)
In-Reply-To: <1093993935.28787.416.camel@nighthawk>

Dave Hansen wrote:

> On Tue, 2004-08-31 at 15:55, Hiroyuki KAMEZAWA wrote:
> 
>>Dave Hansen wrote:
>>
>>
>>>On Tue, 2004-08-31 at 03:41, Hiroyuki KAMEZAWA wrote:
>>>
>>>
>>>>+static void __init calculate_aligned_end(struct zone *zone,
>>>>+					 unsigned long start_pfn,
>>>>+					 int nr_pages)
>>>
>>>...
>>>
>>>
>>>>+		end_address = (zone->zone_start_pfn + end_idx) << PAGE_SHIFT;
>>>>+#ifndef CONFIG_DISCONTIGMEM
>>>>+		reserve_bootmem(end_address,PAGE_SIZE);
>>>>+#else
>>>>+		reserve_bootmem_node(zone->zone_pgdat,end_address,PAGE_SIZE);
>>>>+#endif
>>>>+	}
>>>>+	return;
>>>>+}
>>>
>>>
>>>What if someone has already reserved that address?  You might not be
>>>able to grow the zone, right?
>>>
>>
>>1) If someone has already reserved that address,  it (the page) will not join to
>>   buddy allocator and it's no problem.
>>
>>2) No, I can grow the zone.
>>   A reserved page is the last page of "not aligned contiguous mem_map", not zone.
>>
>>I answer your question ?
> 
> 
> If the end of the zone isn't aligned, you simply waste memory until it becomes aligned, right?
> 
No. I waste just one page, the end page of mem_map.
When the end of mem_map is not aligned, there are 2 cases.

case 1) length of mem_map is even number.
 -------------------------------
 |  |  |  |  |C |  |B |  |A | X|  no-page-area    order=0
 -------------------------------
 |     |     |C    |B    |                        order=1
 -------------------------
 |           |C          |                        order=2
 -------------------------
X is reserved and will not join to buddy system.
By doing this,
page "A" has no boddy in order=0, "X" is reserved.
page "B" has no buddy in order=1, "A" is order 0.
page "C" has no buddy in order=2, "A" is order 0.
..........

case 2) length of mem_map is odd number.
-----------------------------
 |  |  |  |  |C |  |B |  |X |    no-page-area    order=0
 ----------------------------
 |     |     |C    |B    |                       order=1
 -------------------------
 |           |C          |                       order=2
 -------------------------
page "B" has no buddy in order=1, X is reserved.
.........

Access to no-page-area in buddy system does not occur.

-- Kame

-- 
--the clue is these footmarks leading to the door.--
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>


WARNING: multiple messages have this Message-ID (diff)
From: Hiroyuki KAMEZAWA <kamezawa.hiroyu@jp.fujitsu.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: Linux Kernel ML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	lhms <lhms-devel@lists.sourceforge.net>
Subject: Re: [Lhms-devel] Re: [RFC] buddy allocator without bitmap(2) [1/3]
Date: Wed, 01 Sep 2004 08:36:25 +0900	[thread overview]
Message-ID: <41350B79.1070305@jp.fujitsu.com> (raw)
In-Reply-To: <1093993935.28787.416.camel@nighthawk>

Dave Hansen wrote:

> On Tue, 2004-08-31 at 15:55, Hiroyuki KAMEZAWA wrote:
> 
>>Dave Hansen wrote:
>>
>>
>>>On Tue, 2004-08-31 at 03:41, Hiroyuki KAMEZAWA wrote:
>>>
>>>
>>>>+static void __init calculate_aligned_end(struct zone *zone,
>>>>+					 unsigned long start_pfn,
>>>>+					 int nr_pages)
>>>
>>>...
>>>
>>>
>>>>+		end_address = (zone->zone_start_pfn + end_idx) << PAGE_SHIFT;
>>>>+#ifndef CONFIG_DISCONTIGMEM
>>>>+		reserve_bootmem(end_address,PAGE_SIZE);
>>>>+#else
>>>>+		reserve_bootmem_node(zone->zone_pgdat,end_address,PAGE_SIZE);
>>>>+#endif
>>>>+	}
>>>>+	return;
>>>>+}
>>>
>>>
>>>What if someone has already reserved that address?  You might not be
>>>able to grow the zone, right?
>>>
>>
>>1) If someone has already reserved that address,  it (the page) will not join to
>>   buddy allocator and it's no problem.
>>
>>2) No, I can grow the zone.
>>   A reserved page is the last page of "not aligned contiguous mem_map", not zone.
>>
>>I answer your question ?
> 
> 
> If the end of the zone isn't aligned, you simply waste memory until it becomes aligned, right?
> 
No. I waste just one page, the end page of mem_map.
When the end of mem_map is not aligned, there are 2 cases.

case 1) length of mem_map is even number.
 -------------------------------
 |  |  |  |  |C |  |B |  |A | X|  no-page-area    order=0
 -------------------------------
 |     |     |C    |B    |                        order=1
 -------------------------
 |           |C          |                        order=2
 -------------------------
X is reserved and will not join to buddy system.
By doing this,
page "A" has no boddy in order=0, "X" is reserved.
page "B" has no buddy in order=1, "A" is order 0.
page "C" has no buddy in order=2, "A" is order 0.
..........

case 2) length of mem_map is odd number.
-----------------------------
 |  |  |  |  |C |  |B |  |X |    no-page-area    order=0
 ----------------------------
 |     |     |C    |B    |                       order=1
 -------------------------
 |           |C          |                       order=2
 -------------------------
page "B" has no buddy in order=1, X is reserved.
.........

Access to no-page-area in buddy system does not occur.

-- Kame

-- 
--the clue is these footmarks leading to the door.--
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2004-08-31 23:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-31 10:41 [RFC] buddy allocator without bitmap(2) [1/3] Hiroyuki KAMEZAWA
2004-08-31 10:41 ` Hiroyuki KAMEZAWA
2004-08-31 16:30 ` Dave Hansen
2004-08-31 16:30   ` Dave Hansen
2004-08-31 22:55   ` [Lhms-devel] " Hiroyuki KAMEZAWA
2004-08-31 22:55     ` Hiroyuki KAMEZAWA
2004-08-31 23:12     ` Dave Hansen
2004-08-31 23:12       ` Dave Hansen
2004-08-31 23:36       ` Hiroyuki KAMEZAWA [this message]
2004-08-31 23:36         ` Hiroyuki KAMEZAWA

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=41350B79.1070305@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=haveblue@us.ibm.com \
    --cc=lhms-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.