lkml.org 
[lkml]   [2008]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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.



    \
     
     \ /
      Last update: 2008-12-18 21:03    [W:0.035 / U:30.980 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site