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
13611361
13621362 for (i = 0; i < NR_LRU_LISTS; i++)
13631363 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)));
13651365
13661366 pr_cont("\n");
13671367 }
@@ -2997,8 +2997,8 @@ static void accumulate_memcg_tree(struct mem_cgroup *memcg, · 1629 unmodified lines
29972997 acc->events_array ? acc->events_array[i] : i);
29982998
29992999 for (i = 0; i < NR_LRU_LISTS; i++)
3000− acc->lru_pages[i] +=
3001− mem_cgroup_nr_lru_pages(mi, BIT(i));
3000+ acc->lru_pages[i] += memcg_page_state(mi,
3001+ NR_LRU_BASE + i);
30023002 }
30033003 }
30043004
@@ -3428,7 +3428,8 @@ static int memcg_stat_show(struct seq_file *m, void *v) · 423 unmodified lines
34283428
34293429 for (i = 0; i < NR_LRU_LISTS; i++)
34303430 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);
34323433
34333434 /* Hierarchical information */
34343435 memory = memsw = PAGE_COUNTER_MAX;
@@ -3934,8 +3935,8 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, · 499 unmodified lines
39343935
39353936 /* this should eventually include NR_UNSTABLE_NFS */
39363937 *pwriteback = memcg_exact_page_state(memcg, NR_WRITEBACK);
3937− *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) |
3938− (1 << LRU_ACTIVE_FILE));
3938+ *pfilepages = memcg_exact_page_state(memcg, NR_INACTIVE_FILE) +
3939+ memcg_exact_page_state(memcg, NR_ACTIVE_FILE);
39393940 *pheadroom = PAGE_COUNTER_MAX;
39403941
39413942 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