All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Seth Jennings <sjenning@linux.vnet.ibm.com>, gregkh@suse.de
Cc: cascardo@holoscopio.com, rdunlap@xenotime.net,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, rcj@linux.vnet.ibm.com,
	brking@linux.vnet.ibm.com
Subject: RE: [PATCH] staging: zcache: remove zcache_direct_reclaim_lock
Date: Wed, 12 Oct 2011 13:39:10 -0700 (PDT)	[thread overview]
Message-ID: <3e84809b-a45d-4980-b342-c2d671f87f79@default> (raw)
In-Reply-To: <1318448460-5930-1-git-send-email-sjenning@linux.vnet.ibm.com>

> From: Seth Jennings [mailto:sjenning@linux.vnet.ibm.com]
> Subject: [PATCH] staging: zcache: remove zcache_direct_reclaim_lock
> 
> zcache_do_preload() currently does a spin_trylock() on the
> zcache_direct_reclaim_lock. Holding this lock intends to prevent
> shrink_zcache_memory() from evicting zbud pages as a result
> of a preload.
>
> However, it also prevents two threads from
> executing zcache_do_preload() at the same time.  The first
> thread will obtain the lock and the second thread's spin_trylock()
> will fail (an aborted preload) causing the page to be either lost
> (cleancache) or pushed out to the swap device (frontswap). It
> also doesn't ensure that the call to shrink_zcache_memory() is
> on the same thread as the call to zcache_do_preload().

Yes, this looks to be leftover code from early in kztmem/zcache
development.  Good analysis.
 
> Additional, there is no need for this mechanism because all
> zcache_do_preload() calls that come down from cleancache already
> have PF_MEMALLOC set in the process flags which prevents
> direct reclaim in the memory manager. If the zcache_do_preload()

Might it be worthwhile to add a BUG/ASSERT for the presence
of PF_MEMALLOC, or at least a comment in the code?

> call is done from the frontswap path, we _want_ reclaim to be
> done (which it isn't right now).
> 
> This patch removes the zcache_direct_reclaim_lock and related
> statistics in zcache.
> 
> Based on v3.1-rc8
> 
> Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
> Reviewed-by: Dave Hansen <dave@linux.vnet.ibm.com>

With added code/comment per above...
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>

WARNING: multiple messages have this Message-ID (diff)
From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Seth Jennings <sjenning@linux.vnet.ibm.com>, gregkh@suse.de
Cc: cascardo@holoscopio.com, rdunlap@xenotime.net,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, rcj@linux.vnet.ibm.com,
	brking@linux.vnet.ibm.com
Subject: RE: [PATCH] staging: zcache: remove zcache_direct_reclaim_lock
Date: Wed, 12 Oct 2011 13:39:10 -0700 (PDT)	[thread overview]
Message-ID: <3e84809b-a45d-4980-b342-c2d671f87f79@default> (raw)
In-Reply-To: <1318448460-5930-1-git-send-email-sjenning@linux.vnet.ibm.com>

> From: Seth Jennings [mailto:sjenning@linux.vnet.ibm.com]
> Subject: [PATCH] staging: zcache: remove zcache_direct_reclaim_lock
> 
> zcache_do_preload() currently does a spin_trylock() on the
> zcache_direct_reclaim_lock. Holding this lock intends to prevent
> shrink_zcache_memory() from evicting zbud pages as a result
> of a preload.
>
> However, it also prevents two threads from
> executing zcache_do_preload() at the same time.  The first
> thread will obtain the lock and the second thread's spin_trylock()
> will fail (an aborted preload) causing the page to be either lost
> (cleancache) or pushed out to the swap device (frontswap). It
> also doesn't ensure that the call to shrink_zcache_memory() is
> on the same thread as the call to zcache_do_preload().

Yes, this looks to be leftover code from early in kztmem/zcache
development.  Good analysis.
 
> Additional, there is no need for this mechanism because all
> zcache_do_preload() calls that come down from cleancache already
> have PF_MEMALLOC set in the process flags which prevents
> direct reclaim in the memory manager. If the zcache_do_preload()

Might it be worthwhile to add a BUG/ASSERT for the presence
of PF_MEMALLOC, or at least a comment in the code?

> call is done from the frontswap path, we _want_ reclaim to be
> done (which it isn't right now).
> 
> This patch removes the zcache_direct_reclaim_lock and related
> statistics in zcache.
> 
> Based on v3.1-rc8
> 
> Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
> Reviewed-by: Dave Hansen <dave@linux.vnet.ibm.com>

With added code/comment per above...
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-10-12 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-12 19:41 [PATCH] staging: zcache: remove zcache_direct_reclaim_lock Seth Jennings
2011-10-12 19:41 ` Seth Jennings
2011-10-12 20:39 ` Dan Magenheimer [this message]
2011-10-12 20:39   ` Dan Magenheimer
2011-10-14 17:04   ` Seth Jennings
2011-10-14 17:04     ` Seth Jennings
2011-10-14 18:21     ` Seth Jennings
2011-10-14 18:21       ` Seth Jennings
2011-10-17 20:14   ` Dan Magenheimer
2011-10-17 20:14     ` Dan Magenheimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e84809b-a45d-4980-b342-c2d671f87f79@default \
    --to=dan.magenheimer@oracle.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=cascardo@holoscopio.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rcj@linux.vnet.ibm.com \
    --cc=rdunlap@xenotime.net \
    --cc=sjenning@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.