aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/res_counter.h
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-02-07 03:13:57 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:18 -0500
commit0eea10301708c64a6b793894c156e21ddd15eb64 (patch)
treea0dcbe47d48d35ec0554faa5f86068cfab94ca6e /include/linux/res_counter.h
parent66e1707bc34609f626e2e7b4fe7e454c9748bad5 (diff)
Memory controller improve user interface
Change the interface to use bytes instead of pages. Page sizes can vary across platforms and configurations. A new strategy routine has been added to the resource counters infrastructure to format the data as desired. Suggested by David Rientjes, Andrew Morton and Herbert Poetzl Tested on a UML setup with the config for memory control enabled. [kamezawa.hiroyu@jp.fujitsu.com: possible race fix in res_counter] Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Pavel Emelianov <xemul@openvz.org> Cc: Paul Menage <menage@google.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Kirill Korotaev <dev@sw.ru> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: David Rientjes <rientjes@google.com> Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/res_counter.h')
-rw-r--r--include/linux/res_counter.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 5e60a4f34243..61363ce896d5 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -23,15 +23,15 @@ struct res_counter {
23 /* 23 /*
24 * the current resource consumption level 24 * the current resource consumption level
25 */ 25 */
26 unsigned long usage; 26 unsigned long long usage;
27 /* 27 /*
28 * the limit that usage cannot exceed 28 * the limit that usage cannot exceed
29 */ 29 */
30 unsigned long limit; 30 unsigned long long limit;
31 /* 31 /*
32 * the number of unsuccessful attempts to consume the resource 32 * the number of unsuccessful attempts to consume the resource
33 */ 33 */
34 unsigned long failcnt; 34 unsigned long long failcnt;
35 /* 35 /*
36 * the lock to protect all of the above. 36 * the lock to protect all of the above.
37 * the routines below consider this to be IRQ-safe 37 * the routines below consider this to be IRQ-safe
@@ -52,9 +52,11 @@ struct res_counter {
52 */ 52 */
53 53
54ssize_t res_counter_read(struct res_counter *counter, int member, 54ssize_t res_counter_read(struct res_counter *counter, int member,
55 const char __user *buf, size_t nbytes, loff_t *pos); 55 const char __user *buf, size_t nbytes, loff_t *pos,
56 int (*read_strategy)(unsigned long long val, char *s));
56ssize_t res_counter_write(struct res_counter *counter, int member, 57ssize_t res_counter_write(struct res_counter *counter, int member,
57 const char __user *buf, size_t nbytes, loff_t *pos); 58 const char __user *buf, size_t nbytes, loff_t *pos,
59 int (*write_strategy)(char *buf, unsigned long long *val));
58 60
59/* 61/*
60 * the field descriptors. one for each member of res_counter 62 * the field descriptors. one for each member of res_counter