diff options
author | Fernando Luis Vazquez Cao <[email protected]> | 2009-01-07 18:07:51 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2009-01-08 08:31:04 -0800 |
commit | 0753b0ef3b301895234fed02bea2c099c7ff4feb (patch) | |
tree | 35d01368e76d0e5ad21b38fc80274154f8a35d62 | |
parent | 01b1ae63c2270cbacfd43fea94578c17950eb548 (diff) |
memcg: do not recalculate section unnecessarily in init_section_page_cgroup
In init_section_page_cgroup() the section a given pfn belongs to is
calculated at the top of the function and, despite the fact that the
pfn/section correspondence does not change, it is recalculated further
down the same function. By computing this just once and reusing that
value we save some bytes in the object file and do not waste CPU cycles.
Signed-off-by: Fernando Luis Vazquez Cao <[email protected]>
Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Daisuke Nishimura <[email protected]>
Cc: Balbir Singh <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/page_cgroup.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index d6507a660ed6..df1e54a5ed19 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c @@ -103,13 +103,11 @@ struct page_cgroup *lookup_page_cgroup(struct page *page) /* __alloc_bootmem...() is protected by !slab_available() */ static int __init_refok init_section_page_cgroup(unsigned long pfn) { - struct mem_section *section; + struct mem_section *section = __pfn_to_section(pfn); struct page_cgroup *base, *pc; unsigned long table_size; int nid, index; - section = __pfn_to_section(pfn); - if (!section->page_cgroup) { nid = page_to_nid(pfn_to_page(pfn)); table_size = sizeof(struct page_cgroup) * PAGES_PER_SECTION; @@ -145,7 +143,6 @@ static int __init_refok init_section_page_cgroup(unsigned long pfn) __init_page_cgroup(pc, pfn + index); } - section = __pfn_to_section(pfn); section->page_cgroup = base - pfn; total_usage += table_size; return 0; |