Re: [PATCH] mm/zbud: init user ops only when it is needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 10/16/2014 05:17 AM, Andrew Morton wrote:
On Wed, 15 Oct 2014 19:00:43 +0900 Heesub Shin <heesub.shin@xxxxxxxxxxx> wrote:

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.

Which callsite is calling zbud_zpool_create(..., NULL)?

Currently nowhere. zswap is the only user of zbud and always passes a pointer to user-defined operation on pool creation. In addition, there may be less possibility that pool shrinking is requested by users who did not provide the user-defined ops. So, we may not need to worry much about what I wrote in the changelog. However, it is definitely weird to pass an argument, zpool_ops, which even will not be referenced by zbud_zpool_create(). Above all, it would be more useful to avoid the possibility in the future rather than just ignoring it.

regards,
heesub


...
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -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)



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]