Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119519
b: refs/heads/master
c: dc19f9d
h: refs/heads/master
i:
  119517: affac69
  119515: 5cce4a7
  119511: c23044a
  119503: 31dc5bf
  119487: 4365bd2
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Dec 2, 2008
1 parent 82cfcf1 commit ddaf1e2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b29acbdcf877009af3f1fc0750bcac314c51e055
refs/heads/master: dc19f9db38295f811d9041bd89b113beccbd763a
43 changes: 29 additions & 14 deletions trunk/mm/page_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,29 @@ int __init_refok init_section_page_cgroup(unsigned long pfn)

section = __pfn_to_section(pfn);

if (section->page_cgroup)
return 0;

nid = page_to_nid(pfn_to_page(pfn));

table_size = sizeof(struct page_cgroup) * PAGES_PER_SECTION;
if (slab_is_available()) {
base = kmalloc_node(table_size, GFP_KERNEL, nid);
if (!base)
base = vmalloc_node(table_size, nid);
} else {
base = __alloc_bootmem_node_nopanic(NODE_DATA(nid), table_size,
if (!section->page_cgroup) {
nid = page_to_nid(pfn_to_page(pfn));
table_size = sizeof(struct page_cgroup) * PAGES_PER_SECTION;
if (slab_is_available()) {
base = kmalloc_node(table_size, GFP_KERNEL, nid);
if (!base)
base = vmalloc_node(table_size, nid);
} else {
base = __alloc_bootmem_node_nopanic(NODE_DATA(nid),
table_size,
PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
}
} else {
/*
* We don't have to allocate page_cgroup again, but
* address of memmap may be changed. So, we have to initialize
* again.
*/
base = section->page_cgroup + pfn;
table_size = 0;
/* check address of memmap is changed or not. */
if (base->page == pfn_to_page(pfn))
return 0;
}

if (!base) {
Expand Down Expand Up @@ -208,18 +218,23 @@ static int __meminit page_cgroup_callback(struct notifier_block *self,
ret = online_page_cgroup(mn->start_pfn,
mn->nr_pages, mn->status_change_nid);
break;
case MEM_CANCEL_ONLINE:
case MEM_OFFLINE:
offline_page_cgroup(mn->start_pfn,
mn->nr_pages, mn->status_change_nid);
break;
case MEM_CANCEL_ONLINE:
case MEM_GOING_OFFLINE:
break;
case MEM_ONLINE:
case MEM_CANCEL_OFFLINE:
break;
}
ret = notifier_from_errno(ret);

if (ret)
ret = notifier_from_errno(ret);
else
ret = NOTIFY_OK;

return ret;
}

Expand Down
6 changes: 4 additions & 2 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2931,8 +2931,10 @@ static int slab_memory_callback(struct notifier_block *self,
case MEM_CANCEL_OFFLINE:
break;
}

ret = notifier_from_errno(ret);
if (ret)
ret = notifier_from_errno(ret);
else
ret = NOTIFY_OK;
return ret;
}

Expand Down

0 comments on commit ddaf1e2

Please sign in to comment.