linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: Johannes Weiner <hannes@saeurebad.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>, Ingo Molnar <mingo@elte.hu>,
	Andi Kleen <andi@firstfloor.org>,
	Yasunori Goto <y-goto@jp.fujitsu.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Christoph Lameter <clameter@sgi.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC][patch 2/5] mm: Node-setup agnostic free_bootmem()
Date: Wed, 16 Apr 2008 10:54:57 -0700	[thread overview]
Message-ID: <86802c440804161054h6f0cfc3dmde49006afb7889b2@mail.gmail.com> (raw)
In-Reply-To: <20080416113719.092060936@skyscraper.fehenstaub.lan>

On Wed, Apr 16, 2008 at 4:36 AM, Johannes Weiner <hannes@saeurebad.de> wrote:
> Make free_bootmem() look up the node holding the specified address
>  range which lets it work transparently on single-node and multi-node
>  configurations.
>
>  If the address range exceeds the node range, it well be marked free
>  across node boundaries, too.
>
>  Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
>  CC: Ingo Molnar <mingo@elte.hu>
>  CC: Andi Kleen <andi@firstfloor.org>
>  CC: Yinghai Lu <yhlu.kernel@gmail.com>
>  CC: Yasunori Goto <y-goto@jp.fujitsu.com>
>  CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>  CC: Christoph Lameter <clameter@sgi.com>
>  CC: Andrew Morton <akpm@linux-foundation.org>
>  ---
>   mm/bootmem.c |   10 +++++++++-
>   1 files changed, 9 insertions(+), 1 deletions(-)
>
>  Index: tree-linus/mm/bootmem.c
>  ===================================================================
>  --- tree-linus.orig/mm/bootmem.c
>  +++ tree-linus/mm/bootmem.c
>  @@ -421,7 +421,32 @@ int __init reserve_bootmem(unsigned long
>
>   void __init free_bootmem(unsigned long addr, unsigned long size)
>   {
>  -       free_bootmem_core(NODE_DATA(0)->bdata, addr, size);
>  +       bootmem_data_t *bdata;
>  +       unsigned long pos = addr;
>  +       unsigned long partsize = size;
>  +
>  +       list_for_each_entry(bdata, &bdata_list, list) {
>  +               unsigned long remainder = 0;
>  +
>  +               if (pos < bdata->node_boot_start)
>  +                       continue;
>  +
>  +               if (PFN_DOWN(pos + partsize) > bdata->node_low_pfn) {
>  +                       remainder = PFN_DOWN(pos + partsize) - bdata->node_low_pfn;
>  +                       partsize -= remainder;
>  +               }
>  +
>  +               free_bootmem_core(bdata, pos, partsize);
>  +
>  +               if (!remainder)
>  +                       return;
>  +
>  +               pos = PFN_PHYS(bdata->node_low_pfn + 1);
>  +       }
>  +       printk(KERN_ERR "free_bootmem: request: addr=%lx, size=%lx, "
>  +                       "state: pos=%lx, partsize=%lx\n", addr, size,
>  +                       pos, partsize);
>  +       BUG();
>   }
>
>   unsigned long __init free_all_bootmem(void)
>
>  --

Yes, it should work well with cross nodes case.

but please add boundary check on free_bootmem_node too.

YH

--
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:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-04-16 17:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-16 11:36 [RFC][patch 0/5] Bootmem fixes Johannes Weiner
2008-04-16 11:36 ` [RFC][patch 1/5] mm: Revert "mm: fix boundary checking in free_bootmem_core" Johannes Weiner
2008-04-16 17:49   ` Yinghai Lu
2008-04-16 11:36 ` [RFC][patch 2/5] mm: Node-setup agnostic free_bootmem() Johannes Weiner
2008-04-16 17:54   ` Yinghai Lu [this message]
2008-04-16 18:44     ` Yinghai Lu
2008-04-16 18:48       ` Ingo Molnar
2008-04-16 19:17         ` Johannes Weiner
2008-04-18  5:06           ` Yinghai Lu
2008-04-16 19:19     ` Johannes Weiner
2008-04-16 11:36 ` [RFC][patch 3/5] mm: Unexport __alloc_bootmem_core() Johannes Weiner
2008-04-16 11:36 ` [RFC][patch 4/5] mm: Normalize internal argument passing of bootmem data Johannes Weiner
2008-04-16 11:36 ` [RFC][patch 5/5] mm: Move bootmem descriptors definition to a single place Johannes Weiner
2008-04-16 17:30   ` Ralf Baechle
2008-04-17  9:36 ` [RFC][patch 0/5] Bootmem fixes KAMEZAWA Hiroyuki
2008-04-17 10:49   ` Johannes Weiner

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=86802c440804161054h6f0cfc3dmde49006afb7889b2@mail.gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=clameter@sgi.com \
    --cc=hannes@saeurebad.de \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=y-goto@jp.fujitsu.com \
    /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;
as well as URLs for NNTP newsgroup(s).