Skip to content

Commit

Permalink
mm/zbud: init user ops only when it is needed
Browse files Browse the repository at this point in the history
When zbud is initialized through the zpool wrapper, pool->ops which
points to user-defined operations is always set regardless of whether it
is specified from the upper layer. This causes zbud_reclaim_page() to
iterate its loop for evicting pool pages out without any gain.

This patch sets the user-defined ops only when it is needed, so that
zbud_reclaim_page() can bail out the reclamation loop earlier if there
is no user-defined operations specified.

Signed-off-by: Heesub Shin <[email protected]>
Acked-by: Dan Streetman <[email protected]>
Cc: Seth Jennings <[email protected]>
Cc: Sunae Seo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Heesub Shin authored and torvalds committed Dec 13, 2014
1 parent 442cc43 commit 1dd61aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/zbud.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static struct zbud_ops zbud_zpool_ops = {

static void *zbud_zpool_create(gfp_t gfp, struct zpool_ops *zpool_ops)
{
return zbud_create_pool(gfp, &zbud_zpool_ops);
return zbud_create_pool(gfp, zpool_ops ? &zbud_zpool_ops : NULL);
}

static void zbud_zpool_destroy(void *pool)
Expand Down

0 comments on commit 1dd61aa

Please sign in to comment.