The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Anton Blanchard <anton@samba.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Manfreds patch to distribute boot allocations across nodes
Date: Fri, 6 Feb 2004 21:04:28 -0800	[thread overview]
Message-ID: <20040206210428.17ee63db.akpm@osdl.org> (raw)
In-Reply-To: <20040207042559.GP19011@krispykreme>

Anton Blanchard <anton@samba.org> wrote:
>
> Manfred had a patch to distribute kmallocs across nodes during boot.

He's a handy guy.

> ...
> 
> Change in free memory due to patch:
> 
> Node 7 -54.08 MB
> Node 6  -6.33 MB
> Node 5  -6.09 MB
> Node 4  -6.14 MB
> Node 3 -22.15 MB
> Node 2  -6.05 MB
> Node 1  -6.12 MB
> Node 0 107.35 MB

OK.

> +#ifdef CONFIG_NUMA

Is this a thing which all NUMA machines want to be doing?

> +static __init unsigned long get_boot_pages(unsigned int gfp_mask, unsigned int order)
> +{
> +static int nodenr;
> +	int i = nodenr;
> +	struct page *page;
> +
> +	for (;;) {
> +		if (i > nodenr + numnodes)
> +			return 0;
> +		if (node_present_pages(i%numnodes)) {
> +			struct zone **z;
> +			/* The node contains memory. Check that there is 
> +			 * memory in the intended zonelist.
> +			 */
> +			z = NODE_DATA(i%numnodes)->node_zonelists[gfp_mask & GFP_ZONEMASK].zones;
> +			while (*z) {
> +				if ( (*z)->free_pages > (1UL<<order))
> +					goto found_node;
> +				z++;
> +			}
> +		}
> +		i++;
> +	}
> +found_node:
> +	nodenr = i+1;
> +	page = alloc_pages_node(i%numnodes, gfp_mask, order);
> +	if (!page)
> +		return 0;
> +	return (unsigned long) page_address(page);
> +}
> +#endif

Should this not search for the emptiest node?

> @@ -688,6 +724,10 @@
>  {
>  	struct page * page;
>  
> +#ifdef CONFIG_NUMA
> +	if (unlikely(!system_running))
> +		return get_boot_pages(gfp_mask, order);
> +#endif

Is non-__init code allowed to call __init code?  I thought that caused
linkage errors on some setups.  Pretty sure about that.  I think, maybe.

  reply	other threads:[~2004-02-07  5:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-07  4:25 Manfreds patch to distribute boot allocations across nodes Anton Blanchard
2004-02-07  5:04 ` Andrew Morton [this message]
2004-02-07  9:06   ` Anton Blanchard
2004-02-07 19:07     ` Andrew Morton
2004-02-09 16:28       ` Martin Hicks
2004-02-09 17:56         ` Andrew Morton
2004-02-09 20:55           ` Randy.Dunlap
     [not found] <20040207042559.GP19011@krispykreme.suse.lists.linux.kernel>
     [not found] ` <20040206210428.17ee63db.akpm@osdl.org.suse.lists.linux.kernel>
2004-02-07  5:33   ` Andi Kleen
2004-02-07  7:35     ` Martin J. Bligh

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=20040206210428.17ee63db.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.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