Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753503Ab3DPGT3 (ORCPT ); Tue, 16 Apr 2013 02:19:29 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:47405 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753028Ab3DPGT1 (ORCPT ); Tue, 16 Apr 2013 02:19:27 -0400 Date: Tue, 16 Apr 2013 09:19:04 +0300 From: Dan Carpenter To: David Rientjes Cc: Greg Kroah-Hartman , Oskar.Andero@sonymobile.com, "devel@driverdev.osuosl.org" , Brian Swetland , "linux-kernel@vger.kernel.org" , "Dolkow, Snild" , "Lekanovic, Radovan" Subject: Re: [PATCH] lowmemorykiller: prevent multiple instances of low memory killer Message-ID: <20130416061904.GH6638@mwanda> References: <1366031009-21958-1-git-send-email-oskar.andero@sonymobile.com> <20130415131815.GG6638@mwanda> <20130415141358.GO6692@mwanda> <20130415150356.GA22161@caracas.corpusers.net> <20130415194947.GA26557@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1922 Lines: 41 On Mon, Apr 15, 2013 at 04:11:18PM -0700, David Rientjes wrote: > On Mon, 15 Apr 2013, Greg Kroah-Hartman wrote: > > > > The positive numbers are used to return information on the remaining > > > cache size (again, see the comment I pasted above). We could use > > > -EBUSY, but we'd have to change vmscan.c, which checks specifically > > > for -1. I can't see a technical reason why -EBUSY couldn't have been > > > chosen instead, but there's also no real reason to change it now. > > > > If it's not the correct thing to do, sure we can change it, just send a > > patch. It makes way more sense than some random -1 return value to me. > > > > Care to send a series of patches fixing this up properly? > > > > The comment in shrinker.h is misleading, not the source code. > do_shrinker_shrink() will fail for anything negative and 0. The comment is correct. The only acceptable negative return is -1. Look at the second time do_shrinker_shrink() is called from shrink_slab(). 283 while (total_scan >= batch_size) { 284 int nr_before; 285 286 nr_before = do_shrinker_shrink(shrinker, shrink, 0); 287 shrink_ret = do_shrinker_shrink(shrinker, shrink, 288 batch_size); 289 if (shrink_ret == -1) 290 break; 291 if (shrink_ret < nr_before) 292 ret += nr_before - shrink_ret; 293 count_vm_events(SLABS_SCANNED, batch_size); regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/