From: Mel Gorman <mel@csn.ul.ie>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kamezawa.hiroyu@jp.fujitsu.com
Subject: Re: [PATCH 7/7] Add /proc/sys/vm/compact_node for the explicit compaction of a node
Date: Wed, 30 May 2007 09:26:40 +0100 (IST) [thread overview]
Message-ID: <Pine.LNX.4.64.0705300920150.16108@skynet.skynet.ie> (raw)
In-Reply-To: <Pine.LNX.4.64.0705292109460.29854@schroedinger.engr.sgi.com>
On Tue, 29 May 2007, Christoph Lameter wrote:
> On Tue, 29 May 2007, Mel Gorman wrote:
>
>> + if (nodeid < 0)
>> + return -EINVAL;
>> +
>> + pgdat = NODE_DATA(nodeid);
>> + if (!pgdat || pgdat->node_id != nodeid)
>> + return -EINVAL;
>
> You cannot pass an arbitrary number to node data since NODE_DATA may do a
> simple array lookup.
>
> Check for node < nr_node_ids first.
>
Very good point. Will fix
> pgdat->node_id != nodeid? Sounds like something you should BUG() on.
>
On non-NUMA, NODE_DATA(anything) returns contig_page_data. I was catching
where the node ID's didn't match up because node 0 was always returned.
Checking nr_node_ids is the correct way of doing this.
It's not a BUG() if bad ID is passed in here because we're checking user
input. By returning -EINVAL the proc writer knows something bad happened
without making a big deal about it.
> IA64's NODE_DATA is
>
> struct ia64_node_data {
> short active_cpu_count;
> short node;
> struct pglist_data *pg_data_ptrs[MAX_NUMNODES];
> };
>
> /*
> * Given a node id, return a pointer to the pg_data_t for the node.
> *
> * NODE_DATA - should be used in all code not related to system
> * initialization. It uses pernode data structures to minimize
> * offnode memory references. However, these structure are not
> * present during boot. This macro can be used once cpu_init
> * completes.
> */
> #define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid])
>
> x86_64 also does
>
> #define NODE_DATA(nid) (node_data[nid])
>
All spot on. Will fix.
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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>
next prev parent reply other threads:[~2007-05-30 8:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-29 17:36 [PATCH 0/7] [RFC] Memory Compaction v1 Mel Gorman
2007-05-29 17:36 ` [PATCH 1/7] Roll-up patch of what has been sent already Mel Gorman
2007-05-29 17:36 ` [PATCH 2/7] KAMEZAWA Hiroyuki - migration by kernel Mel Gorman
2007-05-30 2:42 ` KAMEZAWA Hiroyuki
2007-05-30 2:47 ` Christoph Lameter
2007-05-30 19:57 ` Hugh Dickins
2007-05-30 20:07 ` Christoph Lameter
2007-05-30 20:10 ` Christoph Lameter
2007-05-31 12:26 ` KAMEZAWA Hiroyuki
2007-05-29 17:37 ` [PATCH 3/7] Allow CONFIG_MIGRATION to be set without CONFIG_NUMA Mel Gorman
2007-05-29 18:01 ` Christoph Lameter
2007-05-29 18:21 ` Mel Gorman
2007-05-29 18:36 ` Christoph Lameter
2007-05-29 18:49 ` Mel Gorman
2007-05-29 17:37 ` [PATCH 4/7] Introduce isolate_lru_page_nolock() as a lockless version of isolate_lru_page() Mel Gorman
2007-05-29 17:37 ` [PATCH 5/7] Provide metrics on the extent of fragmentation in zones Mel Gorman
2007-05-29 17:38 ` [PATCH 6/7] Introduce a means of compacting memory within a zone Mel Gorman
2007-05-29 17:38 ` [PATCH 7/7] Add /proc/sys/vm/compact_node for the explicit compaction of a node Mel Gorman
2007-05-30 4:14 ` Christoph Lameter
2007-05-30 8:26 ` Mel Gorman [this message]
2007-05-30 17:33 ` Christoph Lameter
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=Pine.LNX.4.64.0705300920150.16108@skynet.skynet.ie \
--to=mel@csn.ul.ie \
--cc=clameter@sgi.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox