lkml.org 
[lkml]   [2010]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 06/11] Export fragmentation index via /proc/extfrag_index
    Date
    > +/*
    > + * A fragmentation index only makes sense if an allocation of a requested
    > + * size would fail. If that is true, the fragmentation index indicates
    > + * whether external fragmentation or a lack of memory was the problem.
    > + * The value can be used to determine if page reclaim or compaction
    > + * should be used
    > + */
    > +int fragmentation_index(unsigned int order, struct contig_page_info *info)
    > +{
    > + unsigned long requested = 1UL << order;
    > +
    > + if (!info->free_blocks_total)
    > + return 0;
    > +
    > + /* Fragmentation index only makes sense when a request would fail */
    > + if (info->free_blocks_suitable)
    > + return -1000;
    > +
    > + /*
    > + * Index is between 0 and 1 so return within 3 decimal places
    > + *
    > + * 0 => allocation would fail due to lack of memory
    > + * 1 => allocation would fail due to fragmentation
    > + */
    > + return 1000 - ( (1000+(info->free_pages * 1000 / requested)) / info->free_blocks_total);
    > +}

    Dumb question.

    your paper (http://portal.acm.org/citation.cfm?id=1375634.1375641) says

    fragmentation_index = 1 - (TotalFree/SizeRequested)/BlocksFree

    but your code have extra '1000+'. Why?



    Probably, I haven't understand the intention of this calculation.





    \
     
     \ /
      Last update: 2010-03-17 03:53    [W:0.024 / U:0.220 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site