提交 662f3a0b 编写于 作者: A Andi Kleen 提交者: Linus Torvalds

[PATCH] Remove near all BUGs in mm/mempolicy.c

Most of them can never be triggered and were only for development.
Signed-off-by: N"Andi Kleen" <ak@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 dfcd3c0d
...@@ -185,7 +185,6 @@ static struct zonelist *bind_zonelist(nodemask_t *nodes) ...@@ -185,7 +185,6 @@ static struct zonelist *bind_zonelist(nodemask_t *nodes)
policy_zone = k; policy_zone = k;
} }
} }
BUG_ON(num >= max);
zl->zones[num] = NULL; zl->zones[num] = NULL;
return zl; return zl;
} }
...@@ -709,7 +708,6 @@ static unsigned interleave_nodes(struct mempolicy *policy) ...@@ -709,7 +708,6 @@ static unsigned interleave_nodes(struct mempolicy *policy)
struct task_struct *me = current; struct task_struct *me = current;
nid = me->il_next; nid = me->il_next;
BUG_ON(nid >= MAX_NUMNODES);
next = next_node(nid, policy->v.nodes); next = next_node(nid, policy->v.nodes);
if (next >= MAX_NUMNODES) if (next >= MAX_NUMNODES)
next = first_node(policy->v.nodes); next = first_node(policy->v.nodes);
...@@ -731,18 +729,17 @@ static unsigned offset_il_node(struct mempolicy *pol, ...@@ -731,18 +729,17 @@ static unsigned offset_il_node(struct mempolicy *pol,
nid = next_node(nid, pol->v.nodes); nid = next_node(nid, pol->v.nodes);
c++; c++;
} while (c <= target); } while (c <= target);
BUG_ON(nid >= MAX_NUMNODES);
return nid; return nid;
} }
/* Allocate a page in interleaved policy. /* Allocate a page in interleaved policy.
Own path because it needs to do special accounting. */ Own path because it needs to do special accounting. */
static struct page *alloc_page_interleave(gfp_t gfp, unsigned order, unsigned nid) static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,
unsigned nid)
{ {
struct zonelist *zl; struct zonelist *zl;
struct page *page; struct page *page;
BUG_ON(!node_online(nid));
zl = NODE_DATA(nid)->node_zonelists + gfp_zone(gfp); zl = NODE_DATA(nid)->node_zonelists + gfp_zone(gfp);
page = __alloc_pages(gfp, order, zl); page = __alloc_pages(gfp, order, zl);
if (page && page_zone(page) == zl->zones[0]) { if (page && page_zone(page) == zl->zones[0]) {
...@@ -785,8 +782,6 @@ alloc_page_vma(gfp_t gfp, struct vm_area_struct *vma, unsigned long addr) ...@@ -785,8 +782,6 @@ alloc_page_vma(gfp_t gfp, struct vm_area_struct *vma, unsigned long addr)
unsigned nid; unsigned nid;
if (vma) { if (vma) {
unsigned long off; unsigned long off;
BUG_ON(addr >= vma->vm_end);
BUG_ON(addr < vma->vm_start);
off = vma->vm_pgoff; off = vma->vm_pgoff;
off += (addr - vma->vm_start) >> PAGE_SHIFT; off += (addr - vma->vm_start) >> PAGE_SHIFT;
nid = offset_il_node(pol, vma, off); nid = offset_il_node(pol, vma, off);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册