aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-05-22 08:04:51 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-05-22 08:04:51 -0700
commite52c02f76ae684f86f18f0fc7d7577e22a4d9318 (patch)
tree0943aa14e6adce0f4d479a6e158700714f8b9114 /kernel
parentd31d7a1874c710a5c1b589807d53f32d8e7df397 (diff)
downloadhistory-e52c02f76ae684f86f18f0fc7d7577e22a4d9318.tar.gz
[PATCH] small numa api fixups
From: Christoph Hellwig <hch@lst.de> - don't include mempolicy.h in sched.h and mm.h when a forward delcaration is enough. Andi argued against that in the past, but I'd really hate to add another header to two of the includes used in basically every driver when we can include it in the six files actually needing it instead (that number is for my ppc32 system, maybe other arches need more include in their directories) - make numa api fields in tast_struct conditional on CONFIG_NUMA, this gives us a few ugly ifdefs but avoids wasting memory on non-NUMA systems.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/exit.c3
-rw-r--r--kernel/fork.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 5ac2db963f0b2f..1053be962cad5f 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -22,6 +22,7 @@
#include <linux/profile.h>
#include <linux/mount.h>
#include <linux/proc_fs.h>
+#include <linux/mempolicy.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
@@ -791,7 +792,9 @@ asmlinkage NORET_TYPE void do_exit(long code)
__exit_fs(tsk);
exit_namespace(tsk);
exit_thread();
+#ifdef CONFIG_NUMA
mpol_free(tsk->mempolicy);
+#endif
if (tsk->signal->leader)
disassociate_ctty(1);
diff --git a/kernel/fork.c b/kernel/fork.c
index 2297ac8d0a0fb9..8909a42c442090 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -21,6 +21,7 @@
#include <linux/completion.h>
#include <linux/namespace.h>
#include <linux/personality.h>
+#include <linux/mempolicy.h>
#include <linux/sem.h>
#include <linux/file.h>
#include <linux/binfmts.h>
@@ -972,12 +973,14 @@ struct task_struct *copy_process(unsigned long clone_flags,
p->security = NULL;
p->io_context = NULL;
p->audit_context = NULL;
+#ifdef CONFIG_NUMA
p->mempolicy = mpol_copy(p->mempolicy);
if (IS_ERR(p->mempolicy)) {
retval = PTR_ERR(p->mempolicy);
p->mempolicy = NULL;
goto bad_fork_cleanup;
}
+#endif
retval = -ENOMEM;
if ((retval = security_task_alloc(p)))
@@ -1128,7 +1131,9 @@ bad_fork_cleanup_audit:
bad_fork_cleanup_security:
security_task_free(p);
bad_fork_cleanup_policy:
+#ifdef CONFIG_NUMA
mpol_free(p->mempolicy);
+#endif
bad_fork_cleanup:
if (p->pid > 0)
free_pidmap(p->pid);