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:	Thu, 18 Dec 2008 15:00:27 -0500
From:	Oren Laadan <orenl@...columbia.edu>
To:	Dave Hansen <dave@...ux.vnet.ibm.com>
CC:	Mike Waychison <mikew@...gle.com>, jeremy@...p.org, arnd@...db.de,
	linux-api@...r.kernel.org, containers@...ts.linux-foundation.org,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	Linux Torvalds <torvalds@...l.org>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: [RFC v11][PATCH 05/13] Dump memory address space



Dave Hansen wrote:
> On Thu, 2008-12-18 at 06:10 -0500, Oren Laadan wrote:
>>>> +    for (i = pgarr->nr_used; i--; /**/)
>>>> +        page_cache_release(pgarr->pages[i]);
>>> This is sorta hard to read (and non-intuitive).  Is it easier to do:
>>>
>>> for (i = 0; i < pgarr->nr_used; i++)
>>>     page_cache_release(pgarr->pages[i]);
>>>
>>> It shouldn't matter what order you release the pages in..
>> Was meant to avoid a dereference to 'pgarr->nr_used' in the comparison.
>> (though I doubt if the performance impact is at all visible)
> 
> That's a bit to aggressive an optimization.  You two piqued my
> curiosity, so I tried a little experiment with this .c file:
> 
> extern void bar(int i);
> 
> struct s {
>         int *array;
>         int size;
> };
> 
> extern struct s *s;
> void foo(void)
> {
>         int i;
> #ifdef OREN
>         for (i = s->size; i--; )
> #else
>         for (i = 0; i < s->size; i++)
> #endif
>                 bar(s->array[i]);
> }
> 
> for O in "" -O -O1 -O2 -O3 -Os; do
> 	gcc -DOREN $O -c f1.c -o oren.o;
> 	gcc $O -c f1.c -o mike.o;
> 	echo -n Oren:; objdump -d oren.o | grep ret;
> 	echo -n Mike:; objdump -d mike.o | grep ret;
> done

For what it's worth, the idea was to improve time... (not code length).
I changed the code anyway (in response to another comment).

Oren.

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ