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>
This commit is contained in:
committed by
Linus Torvalds
parent
66e1707bc3
commit
0eea103017
@@ -23,15 +23,15 @@ struct res_counter {
|
||||
/*
|
||||
* the current resource consumption level
|
||||
*/
|
||||
unsigned long usage;
|
||||
unsigned long long usage;
|
||||
/*
|
||||
* the limit that usage cannot exceed
|
||||
*/
|
||||
unsigned long limit;
|
||||
unsigned long long limit;
|
||||
/*
|
||||
* the number of unsuccessful attempts to consume the resource
|
||||
*/
|
||||
unsigned long failcnt;
|
||||
unsigned long long failcnt;
|
||||
/*
|
||||
* the lock to protect all of the above.
|
||||
* the routines below consider this to be IRQ-safe
|
||||
@@ -52,9 +52,11 @@ struct res_counter {
|
||||
*/
|
||||
|
||||
ssize_t res_counter_read(struct res_counter *counter, int member,
|
||||
const char __user *buf, size_t nbytes, loff_t *pos);
|
||||
const char __user *buf, size_t nbytes, loff_t *pos,
|
||||
int (*read_strategy)(unsigned long long val, char *s));
|
||||
ssize_t res_counter_write(struct res_counter *counter, int member,
|
||||
const char __user *buf, size_t nbytes, loff_t *pos);
|
||||
const char __user *buf, size_t nbytes, loff_t *pos,
|
||||
int (*write_strategy)(char *buf, unsigned long long *val));
|
||||
|
||||
/*
|
||||
* the field descriptors. one for each member of res_counter
|
||||
|
||||
Reference in New Issue
Block a user