lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 29 Dec 2012 12:09:28 +0100
From:	Borislav Petkov <bp@...en8.de>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	"Eric W. Biederman" <ebiederm@...ssion.com>,
	anish singh <anish198519851985@...il.com>,
	amit mehta <gmate.amit@...il.com>,
	Henrique Rodrigues <henriquesilvar@...il.com>,
	kishore kumar <kishoreopen@...il.com>,
	Jonathan Neuschäfer <j.neuschaefer@....net>,
	linux-kernel@...r.kernel.org, Kernelnewbies@...nelnewbies.org
Subject: Re: how to look for source code in kernel

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists