aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRobin Holt <holt@sgi.com>2006-01-14 16:20:48 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-14 21:27:07 -0500
commit7339ff8302fd70aabf5f1ae26e0c4905fa74a495 (patch)
tree38ee561d51b7e4db7c0d6dd9ebd9fc22c2b6ab88 /include/linux
parent852cf918dcf2ae46468b425e679fbcbf0ea8fdbb (diff)
[PATCH] Add tmpfs options for memory placement policies
Anything that writes into a tmpfs filesystem is liable to disproportionately decrease the available memory on a particular node. Since there's no telling what sort of application (e.g. dd/cp/cat) might be dropping large files there, this lets the admin choose the appropriate default behavior for their site's situation. Introduce a tmpfs mount option which allows specifying a memory policy and a second option to specify the nodelist for that policy. With the default policy, tmpfs will behave as it does today. This patch adds support for preferred, bind, and interleave policies. The default policy will cause pages to be added to tmpfs files on the node which is doing the writing. Some jobs expect a single process to create and manage the tmpfs files. This results in a node which has a significantly reduced number of free pages. With this patch, the administrator can specify the policy and nodes for that policy where they would prefer allocations. This patch was originally written by Brent Casavant and Hugh Dickins. I added support for the bind and preferred policies and the mpol_nodelist mount option. Signed-off-by: Brent Casavant <bcasavan@sgi.com> Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Robin Holt <holt@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mempolicy.h11
-rw-r--r--include/linux/shmem_fs.h2
2 files changed, 6 insertions, 7 deletions
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index c7ac77e873b3..d6a53ed6ab6c 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -132,12 +132,8 @@ struct shared_policy {
132 spinlock_t lock; 132 spinlock_t lock;
133}; 133};
134 134
135static inline void mpol_shared_policy_init(struct shared_policy *info) 135void mpol_shared_policy_init(struct shared_policy *info, int policy,
136{ 136 nodemask_t *nodes);
137 info->root = RB_ROOT;
138 spin_lock_init(&info->lock);
139}
140
141int mpol_set_shared_policy(struct shared_policy *info, 137int mpol_set_shared_policy(struct shared_policy *info,
142 struct vm_area_struct *vma, 138 struct vm_area_struct *vma,
143 struct mempolicy *new); 139 struct mempolicy *new);
@@ -211,7 +207,8 @@ static inline int mpol_set_shared_policy(struct shared_policy *info,
211 return -EINVAL; 207 return -EINVAL;
212} 208}
213 209
214static inline void mpol_shared_policy_init(struct shared_policy *info) 210static inline void mpol_shared_policy_init(struct shared_policy *info,
211 int policy, nodemask_t *nodes)
215{ 212{
216} 213}
217 214
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index c3e598276e78..c057f0b32318 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -26,6 +26,8 @@ struct shmem_sb_info {
26 unsigned long free_blocks; /* How many are left for allocation */ 26 unsigned long free_blocks; /* How many are left for allocation */
27 unsigned long max_inodes; /* How many inodes are allowed */ 27 unsigned long max_inodes; /* How many inodes are allowed */
28 unsigned long free_inodes; /* How many are left for allocation */ 28 unsigned long free_inodes; /* How many are left for allocation */
29 int policy; /* Default NUMA memory alloc policy */
30 nodemask_t policy_nodes; /* nodemask for preferred and bind */
29 spinlock_t stat_lock; 31 spinlock_t stat_lock;
30}; 32};
31 33