lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86802c440804161144id4f2a68i37513ac0428c693@mail.gmail.com>
Date:	Wed, 16 Apr 2008 11:44:36 -0700
From:	"Yinghai Lu" <yhlu.kernel@...il.com>
To:	"Johannes Weiner" <hannes@...urebad.de>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	"Linux MM" <linux-mm@...ck.org>, "Ingo Molnar" <mingo@...e.hu>,
	"Andi Kleen" <andi@...stfloor.org>,
	"Yasunori Goto" <y-goto@...fujitsu.com>,
	"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@...fujitsu.com>,
	"Christoph Lameter" <clameter@....com>,
	"Andrew Morton" <akpm@...ux-foundation.org>,
	"Siddha, Suresh B" <suresh.b.siddha@...el.com>
Subject: Re: [RFC][patch 2/5] mm: Node-setup agnostic free_bootmem()

On Wed, Apr 16, 2008 at 10:54 AM, Yinghai Lu <yhlu.kernel@...il.com> wrote:
>
> On Wed, Apr 16, 2008 at 4:36 AM, Johannes Weiner <hannes@...urebad.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@...urebad.de>
>  >  CC: Ingo Molnar <mingo@...e.hu>
>  >  CC: Andi Kleen <andi@...stfloor.org>
>  >  CC: Yinghai Lu <yhlu.kernel@...il.com>
>  >  CC: Yasunori Goto <y-goto@...fujitsu.com>
>  >  CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
>  >  CC: Christoph Lameter <clameter@....com>
>  >  CC: Andrew Morton <akpm@...ux-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.

also please note:
it will have problem span nodes box.

for example: node 0: 0-2g, 4-6g, node1: 2-4g, 6-8g.
and if ramdisk sit creoss 2G boundary. you will only free the range before 2g.

YH
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ