All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [Patch: 003/006] pgdat allocation for new node add (generic alloc node_data)
Date: Thu, 20 Apr 2006 16:01:31 -0700	[thread overview]
Message-ID: <20060420160131.7344fe8f.akpm@osdl.org> (raw)
In-Reply-To: <20060420190547.EE4E.Y-GOTO@jp.fujitsu.com>

Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>
>  +#define generic_alloc_nodedata(nid)				\
>  +({								\
>  +	(pg_data_t *)kzalloc(sizeof(pg_data_t), GFP_KERNEL);	\
>  +})

In general, library functions which perform memory allocation should not
make assumptions about which gfp_t they are allowed to use.

So this really should be `generic_alloc_nodedata(nid, gfp_mask)'.

However, it's very desirable that memory allocations use GFP_KERNEL rather
than, say, GFP_ATOMIC.  So your interface here _forces_ callers to be in a
state where GFP_KERNEL is legal, which is good discipline.

Although if that turns out to be a problem, we can expect to see a sad
little patch from someone which tries to change this to GFP_ATOMIC, which
makes everything worse - even those callers who _can_ use GFP_KERNEL.

(In practice, NUMA developers seem to never test with sufficient
CONFIG_DEBUG_* flags enabled, and with CONFIG_PREEMPT, so they happily
don't get to discover their sleep-in-spinlock bugs anyway).

Anyway, on balance, I think it'd be best to convert this API to take a
gfp_t as well.


WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@osdl.org>
To: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [Patch: 003/006] pgdat allocation for new node add (generic alloc node_data)
Date: Thu, 20 Apr 2006 16:01:31 -0700	[thread overview]
Message-ID: <20060420160131.7344fe8f.akpm@osdl.org> (raw)
In-Reply-To: <20060420190547.EE4E.Y-GOTO@jp.fujitsu.com>

Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>
>  +#define generic_alloc_nodedata(nid)				\
>  +({								\
>  +	(pg_data_t *)kzalloc(sizeof(pg_data_t), GFP_KERNEL);	\
>  +})

In general, library functions which perform memory allocation should not
make assumptions about which gfp_t they are allowed to use.

So this really should be `generic_alloc_nodedata(nid, gfp_mask)'.

However, it's very desirable that memory allocations use GFP_KERNEL rather
than, say, GFP_ATOMIC.  So your interface here _forces_ callers to be in a
state where GFP_KERNEL is legal, which is good discipline.

Although if that turns out to be a problem, we can expect to see a sad
little patch from someone which tries to change this to GFP_ATOMIC, which
makes everything worse - even those callers who _can_ use GFP_KERNEL.

(In practice, NUMA developers seem to never test with sufficient
CONFIG_DEBUG_* flags enabled, and with CONFIG_PREEMPT, so they happily
don't get to discover their sleep-in-spinlock bugs anyway).

Anyway, on balance, I think it'd be best to convert this API to take a
gfp_t as well.

--
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:[~2006-04-20 23:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20 10:03 [Patch: 000/006] pgdat allocation for new node add Yasunori Goto
2006-04-20 10:03 ` Yasunori Goto
2006-04-20 10:10 ` [Patch: 001/006] pgdat allocation for new node add (specify node id) Yasunori Goto
2006-04-20 10:10   ` Yasunori Goto
2006-04-20 22:49   ` Andrew Morton
2006-04-20 22:49     ` Andrew Morton
2006-04-20 23:38     ` Yasunori Goto
2006-04-20 23:38       ` Yasunori Goto
2006-04-20 10:10 ` [Patch: 002/006] pgdat allocation for new node add (get node id by acpi) Yasunori Goto
2006-04-20 10:10   ` Yasunori Goto
2006-04-20 10:10 ` [Patch: 003/006] pgdat allocation for new node add (generic alloc node_data) Yasunori Goto
2006-04-20 10:10   ` Yasunori Goto
2006-04-20 23:01   ` Andrew Morton [this message]
2006-04-20 23:01     ` Andrew Morton
2006-04-21  0:23     ` Yasunori Goto
2006-04-21  0:23       ` Yasunori Goto
2006-04-20 10:10 ` [Patch: 004/006] pgdat allocation for new node add (refresh node_data[]) Yasunori Goto
2006-04-20 10:10   ` Yasunori Goto
2006-04-20 10:10 ` [Patch: 005/006] pgdat allocation for new node add (export kswapd start func) Yasunori Goto
2006-04-20 10:10   ` Yasunori Goto
2006-04-20 10:10 ` [Patch: 006/006] pgdat allocation for new node add (call pgdat allocation) Yasunori Goto
2006-04-20 10:10   ` Yasunori Goto

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=20060420160131.7344fe8f.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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 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.