From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752781Ab2L2LJ3 (ORCPT ); Sat, 29 Dec 2012 06:09:29 -0500 Received: from mail.skyhub.de ([78.46.96.112]:44003 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752441Ab2L2LJ0 (ORCPT ); Sat, 29 Dec 2012 06:09:26 -0500 Date: Sat, 29 Dec 2012 12:09:28 +0100 From: Borislav Petkov To: Geert Uytterhoeven Cc: "Eric W. Biederman" , anish singh , amit mehta , Henrique Rodrigues , kishore kumar , Jonathan =?utf-8?Q?Neusch=C3=A4fer?= , linux-kernel@vger.kernel.org, Kernelnewbies@kernelnewbies.org Subject: Re: how to look for source code in kernel Message-ID: <20121229110928.GA17811@x1.alien8.de> Mail-Followup-To: Borislav Petkov , Geert Uytterhoeven , "Eric W. Biederman" , anish singh , amit mehta , Henrique Rodrigues , kishore kumar , Jonathan =?utf-8?Q?Neusch=C3=A4fer?= , linux-kernel@vger.kernel.org, Kernelnewbies@kernelnewbies.org References: <20121227184034.GA2982@debian.debian> <87a9syhbma.fsf@xmission.com> <20121228130734.GB13224@x1.alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 28, 2012 at 11:03:40PM +0100, Geert Uytterhoeven wrote: > That's the first run. Now everything is in the buffer cache (assumed > you have enough RAM), and try again... Right, until you do something else on the box requiring just the right amount of memory to overflow the buffer cache working set and start kicking out pages. Btw, the thing has 4G of RAM. * first run: $ time git ls-files | xargs grep -E 'struct mce\W*{' arch/x86/include/uapi/asm/mce.h:struct mce { arch/x86/kernel/cpu/mcheck/mce.c: if (!final || memcmp(m, final, sizeof(struct mce))) { real 2m48.415s user 0m2.388s sys 0m15.668s * second run coming from the buffer cache, search for something else: $ time git ls-files | xargs grep -E 'struct task_struct\W*{' include/linux/sched.h:struct task_struct { real 0m1.651s user 0m0.672s sys 0m1.048s * do something else (kernel build, git gc, some (very leaky) userspace memory hog, whatever :)) which kicks some buffer cache pages out: $ time git ls-files | xargs grep -E 'struct mce\W*{' arch/x86/include/uapi/asm/mce.h:struct mce { arch/x86/kernel/cpu/mcheck/mce.c: if (!final || memcmp(m, final, sizeof(struct mce))) { real 0m37.360s user 0m1.152s sys 0m4.176s so on a machine with a lot of memory and an SSD, you can probably safely rely on the buffer cache but not on a laptop, in my experience. Btw, cscope can also grep for regex patterns so you don't need the git grep thing anymore, especially since it looks at tracked files only. Thanks. -- Regards/Gruss, Boris.