The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Paul Jackson <pj@sgi.com>, Simon Derr <Simon.Derr@bull.net>,
	Andi Kleen <ak@suse.de>, Christoph Lameter <clameter@sgi.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] cpuset: mempolicy one more nodemask conversion
Date: Thu, 3 Nov 2005 21:31:42 -0800 (PST)	[thread overview]
Message-ID: <20051104053142.549.26590.sendpatchset@jackhammer.engr.sgi.com> (raw)
In-Reply-To: <20051104053109.549.76824.sendpatchset@jackhammer.engr.sgi.com>

Finish converting mm/mempolicy.c from bitmaps to nodemasks.
The previous conversion had left one routine using bitmaps,
since it involved a corresponding change to kernel/cpuset.c

Fix that interface by replacing with a simple macro that
calls nodes_subset(), or if !CONFIG_CPUSET, returns (1).

Signed-off-by: Paul Jackson <pj@sgi.com>

---

 include/linux/cpuset.h |    5 +++--
 kernel/cpuset.c        |   10 ----------
 mm/mempolicy.c         |    5 ++---
 3 files changed, 5 insertions(+), 15 deletions(-)

--- 2.6.14-rc5-mm1-cpuset-patches.orig/include/linux/cpuset.h	2005-11-02 23:18:21.015972401 -0800
+++ 2.6.14-rc5-mm1-cpuset-patches/include/linux/cpuset.h	2005-11-02 23:18:22.437863143 -0800
@@ -21,7 +21,8 @@ extern void cpuset_exit(struct task_stru
 extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p);
 void cpuset_init_current_mems_allowed(void);
 void cpuset_update_current_mems_allowed(void);
-void cpuset_restrict_to_mems_allowed(unsigned long *nodes);
+#define cpuset_nodes_subset_current_mems_allowed(nodes) \
+		nodes_subset((nodes), current->mems_allowed)
 int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
 extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
 extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
@@ -42,7 +43,7 @@ static inline cpumask_t cpuset_cpus_allo
 
 static inline void cpuset_init_current_mems_allowed(void) {}
 static inline void cpuset_update_current_mems_allowed(void) {}
-static inline void cpuset_restrict_to_mems_allowed(unsigned long *nodes) {}
+#define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
 
 static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
 {
--- 2.6.14-rc5-mm1-cpuset-patches.orig/kernel/cpuset.c	2005-11-02 23:18:21.015972401 -0800
+++ 2.6.14-rc5-mm1-cpuset-patches/kernel/cpuset.c	2005-11-02 23:18:22.438839716 -0800
@@ -1790,16 +1790,6 @@ done:
 }
 
 /**
- * cpuset_restrict_to_mems_allowed - limit nodes to current mems_allowed
- * @nodes: pointer to a node bitmap that is and-ed with mems_allowed
- */
-void cpuset_restrict_to_mems_allowed(unsigned long *nodes)
-{
-	bitmap_and(nodes, nodes, nodes_addr(current->mems_allowed),
-							MAX_NUMNODES);
-}
-
-/**
  * cpuset_zonelist_valid_mems_allowed - check zonelist vs. curremt mems_allowed
  * @zl: the zonelist to be checked
  *
--- 2.6.14-rc5-mm1-cpuset-patches.orig/mm/mempolicy.c	2005-11-02 23:18:21.015972401 -0800
+++ 2.6.14-rc5-mm1-cpuset-patches/mm/mempolicy.c	2005-11-02 23:18:22.440792863 -0800
@@ -342,10 +342,9 @@ static int contextualize_policy(int mode
 	if (!nodes)
 		return 0;
 
-	/* Update current mems_allowed */
 	cpuset_update_current_mems_allowed();
-	/* Ignore nodes not set in current->mems_allowed */
-	cpuset_restrict_to_mems_allowed(nodes->bits);
+	if (!cpuset_nodes_subset_current_mems_allowed(*nodes))
+		return -EINVAL;
 	return mpol_check_policy(mode, nodes);
 }
 

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373

  parent reply	other threads:[~2005-11-04  5:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04  5:31 [PATCH 1/5] cpuset: better bitmap remap defaults Paul Jackson
2005-11-04  5:31 ` [PATCH 2/5] cpuset: rebind numa vma mempolicy Paul Jackson
2005-11-07  6:10   ` Paul Jackson
2005-11-04  5:31 ` [PATCH 3/5] cpuset: change marker for relative numbering Paul Jackson
2005-11-05  7:08   ` Andrew Morton
2005-11-06 10:04     ` Paul Jackson
2005-11-06 20:57       ` Andrew Morton
2005-11-06 22:49         ` Paul Jackson
2005-11-04  5:31 ` Paul Jackson [this message]
2005-11-04  5:31 ` [PATCH 5/5] cpuset: memory reclaim rate meter Paul Jackson
2005-11-05  7:13   ` Andrew Morton
2005-11-05  7:34     ` Paul Jackson
2005-11-05  7:43     ` Paul Jackson
2005-11-05  7:27   ` Paul Jackson

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=20051104053142.549.26590.sendpatchset@jackhammer.engr.sgi.com \
    --to=pj@sgi.com \
    --cc=Simon.Derr@bull.net \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=clameter@sgi.com \
    --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