Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62326
b: refs/heads/master
c: d626954
h: refs/heads/master
v: v3
  • Loading branch information
Matt Mackall authored and Linus Torvalds committed Jul 22, 2007
1 parent 5e6c499 commit 19d91b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 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: 41f9dc5c871600f53c8912b2975971d2a11c1c25
refs/heads/master: d6269543ef24aa012aa228c27af3adb074f7b36b
21 changes: 16 additions & 5 deletions trunk/mm/slob.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ static void *slob_page_alloc(struct slob_page *sp, size_t size, int align)
static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
{
struct slob_page *sp;
struct list_head *prev;
slob_t *b = NULL;
unsigned long flags;

Expand All @@ -307,12 +308,22 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
if (node != -1 && page_to_nid(&sp->page) != node)
continue;
#endif
/* Enough room on this page? */
if (sp->units < SLOB_UNITS(size))
continue;

if (sp->units >= SLOB_UNITS(size)) {
b = slob_page_alloc(sp, size, align);
if (b)
break;
}
/* Attempt to alloc */
prev = sp->list.prev;
b = slob_page_alloc(sp, size, align);
if (!b)
continue;

/* Improve fragment distribution and reduce our average
* search time by starting our next search here. (see
* Knuth vol 1, sec 2.5, pg 449) */
if (free_slob_pages.next != prev->next)
list_move_tail(&free_slob_pages, prev->next);
break;
}
spin_unlock_irqrestore(&slob_lock, flags);

Expand Down

0 comments on commit 19d91b6

Please sign in to comment.