Commit e52c02f7 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent d31d7a18
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/mempolicy.h>
#include <asm/param.h> #include <asm/param.h>
#include <asm/signal.h> #include <asm/signal.h>
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/mempolicy.h>
#include <asm/bitops.h> #include <asm/bitops.h>
#include <asm/errno.h> #include <asm/errno.h>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/mempolicy.h>
#include <asm/a.out.h> #include <asm/a.out.h>
#include <asm/bitops.h> #include <asm/bitops.h>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/binfmts.h> #include <linux/binfmts.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/mempolicy.h>
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <linux/security.h> #include <linux/security.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/rmap.h> #include <linux/rmap.h>
#include <linux/mempolicy.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
#include <linux/mmzone.h> #include <linux/mmzone.h>
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mempolicy.h>
struct mempolicy;
#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ #ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */
extern unsigned long max_mapnr; extern unsigned long max_mapnr;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/pid.h> #include <linux/pid.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/mempolicy.h>
struct exec_domain; struct exec_domain;
...@@ -381,6 +380,7 @@ int set_current_groups(struct group_info *group_info); ...@@ -381,6 +380,7 @@ int set_current_groups(struct group_info *group_info);
struct audit_context; /* See audit.c */ struct audit_context; /* See audit.c */
struct mempolicy;
struct task_struct { struct task_struct {
volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
...@@ -510,8 +510,10 @@ struct task_struct { ...@@ -510,8 +510,10 @@ struct task_struct {
unsigned long ptrace_message; unsigned long ptrace_message;
siginfo_t *last_siginfo; /* For ptrace use. */ siginfo_t *last_siginfo; /* For ptrace use. */
#ifdef CONFIG_NUMA
struct mempolicy *mempolicy; struct mempolicy *mempolicy;
short il_next; /* could be shared with used_math */ short il_next; /* could be shared with used_math */
#endif
}; };
static inline pid_t process_group(struct task_struct *tsk) static inline pid_t process_group(struct task_struct *tsk)
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/profile.h> #include <linux/profile.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/mempolicy.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/unistd.h> #include <asm/unistd.h>
...@@ -791,7 +792,9 @@ asmlinkage NORET_TYPE void do_exit(long code) ...@@ -791,7 +792,9 @@ asmlinkage NORET_TYPE void do_exit(long code)
__exit_fs(tsk); __exit_fs(tsk);
exit_namespace(tsk); exit_namespace(tsk);
exit_thread(); exit_thread();
#ifdef CONFIG_NUMA
mpol_free(tsk->mempolicy); mpol_free(tsk->mempolicy);
#endif
if (tsk->signal->leader) if (tsk->signal->leader)
disassociate_ctty(1); disassociate_ctty(1);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/namespace.h> #include <linux/namespace.h>
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/mempolicy.h>
#include <linux/sem.h> #include <linux/sem.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/binfmts.h> #include <linux/binfmts.h>
...@@ -972,12 +973,14 @@ struct task_struct *copy_process(unsigned long clone_flags, ...@@ -972,12 +973,14 @@ struct task_struct *copy_process(unsigned long clone_flags,
p->security = NULL; p->security = NULL;
p->io_context = NULL; p->io_context = NULL;
p->audit_context = NULL; p->audit_context = NULL;
#ifdef CONFIG_NUMA
p->mempolicy = mpol_copy(p->mempolicy); p->mempolicy = mpol_copy(p->mempolicy);
if (IS_ERR(p->mempolicy)) { if (IS_ERR(p->mempolicy)) {
retval = PTR_ERR(p->mempolicy); retval = PTR_ERR(p->mempolicy);
p->mempolicy = NULL; p->mempolicy = NULL;
goto bad_fork_cleanup; goto bad_fork_cleanup;
} }
#endif
retval = -ENOMEM; retval = -ENOMEM;
if ((retval = security_task_alloc(p))) if ((retval = security_task_alloc(p)))
...@@ -1128,7 +1131,9 @@ struct task_struct *copy_process(unsigned long clone_flags, ...@@ -1128,7 +1131,9 @@ struct task_struct *copy_process(unsigned long clone_flags,
bad_fork_cleanup_security: bad_fork_cleanup_security:
security_task_free(p); security_task_free(p);
bad_fork_cleanup_policy: bad_fork_cleanup_policy:
#ifdef CONFIG_NUMA
mpol_free(p->mempolicy); mpol_free(p->mempolicy);
#endif
bad_fork_cleanup: bad_fork_cleanup:
if (p->pid > 0) if (p->pid > 0)
free_pidmap(p->pid); free_pidmap(p->pid);
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/mempolicy.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
static kmem_cache_t *policy_cache; static kmem_cache_t *policy_cache;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/profile.h> #include <linux/profile.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/mempolicy.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/mempolicy.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/swapops.h> #include <linux/swapops.h>
#include <linux/mempolicy.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment