History

mm: memcontrol: push down mem_cgroup_nr_lru_pages()

mem_cgroup_nr_lru_pages() is just a convenience wrapper around memcg_page_state() that takes bitmasks of lru indexes and aggregates the counts for those. Replace callsites where the bitmask is simple enough with direct memcg_page_state() call(s).

Johannes Weiner committed 7 years ago

Commit 21d89d11 parent 2b487e51 file · +7 −6Browse files

Unified · Split

mm/memcontrol.c+7−6
@@ -1361,7 +1361,7 @@ void mem_cgroup_print_oom_meminfo(struct mem_cgroup *memcg) · 1360 unmodified lines
1361 1361
1362 for (i = 0; i < NR_LRU_LISTS; i++)1362 for (i = 0; i < NR_LRU_LISTS; i++)
1363 pr_cont(" %s:%luKB", mem_cgroup_lru_names[i],1363 pr_cont(" %s:%luKB", mem_cgroup_lru_names[i],
1364 K(mem_cgroup_nr_lru_pages(iter, BIT(i))));1364 K(memcg_page_state(iter, NR_LRU_BASE + i)));
1365 1365
1366 pr_cont("\n");1366 pr_cont("\n");
1367 }1367 }
@@ -2997,8 +2997,8 @@ static void accumulate_memcg_tree(struct mem_cgroup *memcg, · 1629 unmodified lines
2997 acc->events_array ? acc->events_array[i] : i);2997 acc->events_array ? acc->events_array[i] : i);
2998 2998
2999 for (i = 0; i < NR_LRU_LISTS; i++)2999 for (i = 0; i < NR_LRU_LISTS; i++)
3000 acc->lru_pages[i] +=3000 acc->lru_pages[i] += memcg_page_state(mi,
3001 mem_cgroup_nr_lru_pages(mi, BIT(i));3001 NR_LRU_BASE + i);
3002 }3002 }
3003}3003}
3004 3004
@@ -3428,7 +3428,8 @@ static int memcg_stat_show(struct seq_file *m, void *v) · 423 unmodified lines
3428 3428
3429 for (i = 0; i < NR_LRU_LISTS; i++)3429 for (i = 0; i < NR_LRU_LISTS; i++)
3430 seq_printf(m, "%s %lu\n", mem_cgroup_lru_names[i],3430 seq_printf(m, "%s %lu\n", mem_cgroup_lru_names[i],
3431 mem_cgroup_nr_lru_pages(memcg, BIT(i)) * PAGE_SIZE);3431 memcg_page_state(memcg, NR_LRU_BASE + i) *
3432 PAGE_SIZE);
3432 3433
3433 /* Hierarchical information */3434 /* Hierarchical information */
3434 memory = memsw = PAGE_COUNTER_MAX;3435 memory = memsw = PAGE_COUNTER_MAX;
@@ -3934,8 +3935,8 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, · 499 unmodified lines
3934 3935
3935 /* this should eventually include NR_UNSTABLE_NFS */3936 /* this should eventually include NR_UNSTABLE_NFS */
3936 *pwriteback = memcg_exact_page_state(memcg, NR_WRITEBACK);3937 *pwriteback = memcg_exact_page_state(memcg, NR_WRITEBACK);
3937 *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) |3938 *pfilepages = memcg_exact_page_state(memcg, NR_INACTIVE_FILE) +
3938 (1 << LRU_ACTIVE_FILE));3939 memcg_exact_page_state(memcg, NR_ACTIVE_FILE);
3939 *pheadroom = PAGE_COUNTER_MAX;3940 *pheadroom = PAGE_COUNTER_MAX;
3940 3941
3941 while ((parent = parent_mem_cgroup(memcg))) {3942 while ((parent = parent_mem_cgroup(memcg))) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t