Balbir Singh wrote:Kirill Korotaev wrote:
because this union is used both for kernel memory accounting and user memeory tracking.+#ifdef CONFIG_BEANCOUNTERS
+ union {
+ struct beancounter *page_bc;
+ } bc;
+#endif
};
+#define page_bc(page) ((page)->bc.page_bc)
Minor comment - page->(bc).page_bc has too many repititions of page and bc - see
the Practice of Programming by Kernighan and Pike
I missed the part of why you wanted to have a union (in struct page for bc)?
This is some arbitraty limited container, just to make sure it is notconst char *bc_rnames[] = {
+ "kmemsize", /* 0 */
};
static struct hlist_head bc_hash[BC_HASH_SIZE];
@@ -221,6 +222,8 @@ static void init_beancounter_syslimits(s
{ int k;
+ bc->bc_parms[BC_KMEMSIZE].limit = 32 * 1024 * 1024;
+
Can't this be configurable CONFIG_XXX or a #defined constant?
created unlimited. User space should initialize limits properly after creation
anyway. So I don't see reasons to make it configurable, do you?
I wonder if bc_page_charge() should be called bc_page_charge_failed()?yes. my intention is to account correctly all needed information first.
Does it make sense to atleast partially start reclamation here? I know with
bean counters we cannot reclaim from a particular container, but for now
we could kick off kswapd() or call shrink_all_memory() inline (Dave's patches do this to shrink memory from the particular cpuset). Or do you want to leave this
slot open for later?
After we agree on accounting, we can agree on how to do reclamaition.