From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ric Mason Subject: Re: [PATCH v2 02/28] vmscan: take at least one pass with shrinkers Date: Wed, 10 Apr 2013 13:09:42 +0800 Message-ID: <5164F416.8040903@gmail.com> References: <1364548450-28254-1-git-send-email-glommer@parallels.com> <1364548450-28254-3-git-send-email-glommer@parallels.com> <515936B5.8070501@jp.fujitsu.com> <515940E4.8050704@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Theodore Ts'o , hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Dave Shrinnker , Michal Hocko , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Al Viro , Johannes Weiner , linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Andrew Morton To: Glauber Costa Return-path: In-Reply-To: <515940E4.8050704-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org Hi Glauber, On 04/01/2013 04:10 PM, Glauber Costa wrote: > Hi Kame, > >> Doesn't this break >> >> == >> /* >> * copy the current shrinker scan count into a local variable >> * and zero it so that other concurrent shrinker invocations >> * don't also do this scanning work. >> */ >> nr = atomic_long_xchg(&shrinker->nr_in_batch, 0); >> == >> >> This xchg magic ? >> >> Thnks, >> -Kame > This is done before the actual reclaim attempt, and all it does is to > indicate to other concurrent shrinkers that "I've got it", and others > should not attempt to shrink. > > Even before I touch this, this quantity represents the number of > entities we will try to shrink. Not necessarily we will succeed. What my > patch does, is to try at least once if the number is too small. > > Before it, we will try to shrink 512 objects and succeed at 0 (because > batch is 1024). After this, we will try to free 512 objects and succeed > at an undefined quantity between 0 and 512. Where you get the magic number 512 and 1024? The value of SHRINK_BATCH is 128. > > In both cases, we will zero out nr_in_batch in the shrinker structure to > notify other shrinkers that we are the ones shrinking. > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo-Bw31MaZKKs0EbZ0PF+XxCw@public.gmane.org For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org