Re: [PATCH 05/11] Export unusable free space index via /proc/unusable_index

From: Minchan Kim
Date: Tue Mar 23 2010 - 20:16:31 EST


Hi, Kame.

On Wed, Mar 24, 2010 at 9:03 AM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> On Tue, 23 Mar 2010 12:25:40 +0000
> Mel Gorman <mel@xxxxxxxxx> wrote:
>
>> Unusable free space index is a measure of external fragmentation that
>> takes the allocation size into account. For the most part, the huge page
>> size will be the size of interest but not necessarily so it is exported
>> on a per-order and per-zone basis via /proc/unusable_index.
>>
>> The index is a value between 0 and 1. It can be expressed as a
>> percentage by multiplying by 100 as documented in
>> Documentation/filesystems/proc.txt.
>>
>> Signed-off-by: Mel Gorman <mel@xxxxxxxxx>
>> Reviewed-by: Minchan Kim <minchan.kim@xxxxxxxxx>
>> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
>> Acked-by: Rik van Riel <riel@xxxxxxxxxx>
>> ---
>> ÂDocumentation/filesystems/proc.txt | Â 13 ++++-
>> Âmm/vmstat.c            Â| Â120 +++++++++++++++++++++++++++++++++
>> Â2 files changed, 132 insertions(+), 1 deletions(-)
>>
>> diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
>> index 5e132b5..5c4b0fb 100644
>> --- a/Documentation/filesystems/proc.txt
>> +++ b/Documentation/filesystems/proc.txt
>> @@ -452,6 +452,7 @@ Table 1-5: Kernel info in /proc
>>  sys     See chapter 2
>>  sysvipc   Info of SysVIPC Resources (msg, sem, shm)        (2.4)
>>  tty   ÂInfo of tty drivers
>> + unusable_index Additional page allocator information (see text)(2.5)
>>  uptime   ÂSystem uptime
>>  version   Kernel version
>>  video      Âbttv info of video resources            (2.4)
>> @@ -609,7 +610,7 @@ ZONE_DMA, 4 chunks of 2^1*PAGE_SIZE in ZONE_DMA, 101 chunks of 2^4*PAGE_SIZE
>> Âavailable in ZONE_NORMAL, etc...
>>
>> ÂMore information relevant to external fragmentation can be found in
>> -pagetypeinfo.
>> +pagetypeinfo and unusable_index
>>
>> Â> cat /proc/pagetypeinfo
>> ÂPage block order: 9
>> @@ -650,6 +651,16 @@ unless memory has been mlock()'d. Some of the Reclaimable blocks should
>> Âalso be allocatable although a lot of filesystem metadata may have to be
>> Âreclaimed to achieve this.
>>
>> +> cat /proc/unusable_index
>> +Node 0, zone   ÂDMA 0.000 0.000 0.000 0.001 0.005 0.013 0.021 0.037 0.037 0.101 0.230
>> +Node 0, zone  Normal 0.000 0.000 0.000 0.001 0.002 0.002 0.005 0.015 0.028 0.028 0.054
>> +
>> +The unusable free space index measures how much of the available free
>> +memory cannot be used to satisfy an allocation of a given size and is a
>> +value between 0 and 1. The higher the value, the more of free memory is
>> +unusable and by implication, the worse the external fragmentation is. This
>> +can be expressed as a percentage by multiplying by 100.
>> +
>> Â..............................................................................
>>
>> Âmeminfo:
>> diff --git a/mm/vmstat.c b/mm/vmstat.c
>> index 7f760cb..ca42e10 100644
>> --- a/mm/vmstat.c
>> +++ b/mm/vmstat.c
>> @@ -453,6 +453,106 @@ static int frag_show(struct seq_file *m, void *arg)
>> Â Â Â return 0;
>> Â}
>>
>> +
>> +struct contig_page_info {
>> + Â Â unsigned long free_pages;
>> + Â Â unsigned long free_blocks_total;
>> + Â Â unsigned long free_blocks_suitable;
>> +};
>> +
>> +/*
>> + * Calculate the number of free pages in a zone, how many contiguous
>> + * pages are free and how many are large enough to satisfy an allocation of
>> + * the target size. Note that this function makes to attempt to estimate
>> + * how many suitable free blocks there *might* be if MOVABLE pages were
>> + * migrated. Calculating that is possible, but expensive and can be
>> + * figured out from userspace
>> + */
>> +static void fill_contig_page_info(struct zone *zone,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â unsigned int suitable_order,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct contig_page_info *info)
>> +{
>> + Â Â unsigned int order;
>> +
>> + Â Â info->free_pages = 0;
>> + Â Â info->free_blocks_total = 0;
>> + Â Â info->free_blocks_suitable = 0;
>> +
>> + Â Â for (order = 0; order < MAX_ORDER; order++) {
>> + Â Â Â Â Â Â unsigned long blocks;
>> +
>> + Â Â Â Â Â Â /* Count number of free blocks */
>> + Â Â Â Â Â Â blocks = zone->free_area[order].nr_free;
>> + Â Â Â Â Â Â info->free_blocks_total += blocks;
>
> ....for what this free_blocks_total is ?

It's used by fragmentation_index in [06/11].

>
> Thanks,
> -Kame
>
>



--
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/