From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH 6/9] readahead: add /debug/readahead/stats Date: Fri, 27 Jan 2012 12:15:51 -0800 Message-ID: <20120127121551.acd256aa.akpm@linux-foundation.org> References: <20120127030524.854259561@intel.com> <20120127031327.159293683@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Wu Fengguang , Andi Kleen , Ingo Molnar , Jens Axboe , Peter Zijlstra , Rik van Riel , Linux Memory Management List , linux-fsdevel@vger.kernel.org, LKML To: Christoph Lameter Return-path: In-Reply-To: Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org On Fri, 27 Jan 2012 10:21:36 -0600 (CST) Christoph Lameter wrote: > > + > > +static void readahead_stats_reset(void) > > +{ > > + int i, j; > > + > > + for (i = 0; i < RA_PATTERN_ALL; i++) > > + for (j = 0; j < RA_ACCOUNT_MAX; j++) > > + percpu_counter_set(&ra_stat[i][j], 0); > > for_each_online(cpu) > memset(per_cpu_ptr(&ra_stat, cpu), 0, sizeof(ra_stat)); for_each_possible_cpu(). And that's one reason to not open-code the operation. Another is so we don't have tiresome open-coded loops all over the place. But before doing either of those things we should choose boring old atomic_inc(). Has it been shown that the cost of doing so is unacceptable? Bearing this in mind: > The accounting code will be compiled in by default > (CONFIG_READAHEAD_STATS=y), and will remain inactive by default. I agree with those choices. They effectively mean that the stats will be a developer-only/debugger-only thing. So even if the atomic_inc() costs are measurable during these develop/debug sessions, is anyone likely to care? -- 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: email@kvack.org