Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74979
b: refs/heads/master
c: bbd0682
h: refs/heads/master
i:
  74977: b803168
  74975: 67a2941
v: v3
  • Loading branch information
WANG Cong authored and Linus Torvalds committed Dec 18, 2007
1 parent 8935f4c commit 424a746
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 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: af0cd5a7c3cded50c25e98acd94912d17a0eb914
refs/heads/master: bbd0682596f7a434467ee551fee18d5f0b818539
18 changes: 12 additions & 6 deletions trunk/mm/sparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,17 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
* no locking for this, because it does its own
* plus, it does a kmalloc
*/
sparse_index_init(section_nr, pgdat->node_id);
ret = sparse_index_init(section_nr, pgdat->node_id);
if (ret < 0 && ret != -EEXIST)
return ret;
memmap = kmalloc_section_memmap(section_nr, pgdat->node_id, nr_pages);
if (!memmap)
return -ENOMEM;
usemap = __kmalloc_section_usemap();
if (!usemap) {
__kfree_section_memmap(memmap, nr_pages);
return -ENOMEM;
}

pgdat_resize_lock(pgdat, &flags);

Expand All @@ -403,18 +411,16 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
goto out;
}

if (!usemap) {
ret = -ENOMEM;
goto out;
}
ms->section_mem_map |= SECTION_MARKED_PRESENT;

ret = sparse_init_one_section(ms, section_nr, memmap, usemap);

out:
pgdat_resize_unlock(pgdat, &flags);
if (ret <= 0)
if (ret <= 0) {
kfree(usemap);
__kfree_section_memmap(memmap, nr_pages);
}
return ret;
}
#endif

0 comments on commit 424a746

Please sign in to comment.