On 04/01/2013 12:18 PM, Kamezawa Hiroyuki wrote: > (2013/03/29 18:14), Glauber Costa wrote: >> With the infrastructure we now have, we can add an element to a memcg >> LRU list instead of the global list. The memcg lists are still >> per-node. >> >> Technically, we will never trigger per-node shrinking in the memcg is >> short of memory. Therefore an alternative to this would be to add the >> element to *both* a single-node memcg array and a per-node global array. >> > > per-node shrinking by memcg pressure is not imporant, I think. > No, it is not. And this is precisely what I've stated: "we will never trigger per-node shrinking in the memcg is short of memory." This is to clarify that this design decision does not come from the need to do that, which we don't have, but rather to save memory. Keeping memcg objects per-node is less memory-expensive than adding an extra LRU to the dentries and inodes. Therefore I do that, and when global pressure kicks in I will scan all memcgs that belong to that node. This will break global LRU order, but will help maintain fairness among different memcgs. >> >> struct list_lru { >> struct list_lru_node node[MAX_NUMNODES]; >> + atomic_long_t node_totals[MAX_NUMNODES]; > > some comments will be helpful. > Yes, they will! >> + >> +static inline struct list_lru_node * >> +lru_node_of_index(struct list_lru *lru, int index, int nid) >> +{ >> + BUG_ON(index < 0); /* index != -1 with !MEMCG_KMEM. Impossible */ >> + return &lru->node[nid]; >> +} >> #endif > > I'm sorry ...what "lru_node_of_index" means ? What is the "index" ? There is extensive documentation for this above the macro for_each_memcg_lru_index, so I didn't bother rewriting it here. But I can add pointers like "see more at for_each..." Basically, this will be either the memcg index if we want memcg reclaim, or -1 for the global LRU. This is not 100 % the memcg index, so I called it just "index". IOW, it is the index in the memcg array if index >= 0, or the global array if index < 0. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html