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:	Mon, 2 Feb 2015 22:26:43 +0900
From:	Joonsoo Kim <js1304@...il.com>
To:	Vlastimil Babka <vbabka@...e.cz>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Mel Gorman <mgorman@...e.de>,
	David Rientjes <rientjes@...gle.com>,
	Rik van Riel <riel@...hat.com>,
	Linux Memory Management List <linux-mm@...ck.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Zhang Yanfei <zhangyanfei@...fujitsu.com>,
	Joonsoo Kim <iamjoonsoo.kim@....com>
Subject: Re: [RFC PATCH v3 2/3] mm/page_alloc: factor out fallback freepage checking

2015-02-02 18:59 GMT+09:00 Vlastimil Babka <vbabka@...e.cz>:
> On 02/02/2015 08:15 AM, Joonsoo Kim wrote:
>> This is preparation step to use page allocator's anti fragmentation logic
>> in compaction. This patch just separates fallback freepage checking part
>> from fallback freepage management part. Therefore, there is no functional
>> change.
>>
>> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@....com>
>> ---
>>  mm/page_alloc.c | 128 +++++++++++++++++++++++++++++++++-----------------------
>>  1 file changed, 76 insertions(+), 52 deletions(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index e64b260..6cb18f8 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -1142,14 +1142,26 @@ static void change_pageblock_range(struct page *pageblock_page,
>>   * as fragmentation caused by those allocations polluting movable pageblocks
>>   * is worse than movable allocations stealing from unmovable and reclaimable
>>   * pageblocks.
>> - *
>> - * If we claim more than half of the pageblock, change pageblock's migratetype
>> - * as well.
>>   */
>> -static void try_to_steal_freepages(struct zone *zone, struct page *page,
>> -                               int start_type, int fallback_type)
>> +static bool can_steal_fallback(unsigned int order, int start_mt)
>> +{
>> +     if (order >= pageblock_order)
>> +             return true;
>> +
>> +     if (order >= pageblock_order / 2 ||
>> +             start_mt == MIGRATE_RECLAIMABLE ||
>> +             start_mt == MIGRATE_UNMOVABLE ||
>> +             page_group_by_mobility_disabled)
>> +             return true;
>> +
>> +     return false;
>> +}
>> +
>> +static void steal_suitable_fallback(struct zone *zone, struct page *page,
>> +                                                       int start_type)
>
> Some comment about the function please?

Okay.

>>  {
>>       int current_order = page_order(page);
>> +     int pages;
>>
>>       /* Take ownership for orders >= pageblock_order */
>>       if (current_order >= pageblock_order) {
>> @@ -1157,19 +1169,39 @@ static void try_to_steal_freepages(struct zone *zone, struct page *page,
>>               return;
>>       }
>>
>> -     if (current_order >= pageblock_order / 2 ||
>> -         start_type == MIGRATE_RECLAIMABLE ||
>> -         start_type == MIGRATE_UNMOVABLE ||
>> -         page_group_by_mobility_disabled) {
>> -             int pages;
>> +     pages = move_freepages_block(zone, page, start_type);
>>
>> -             pages = move_freepages_block(zone, page, start_type);
>> +     /* Claim the whole block if over half of it is free */
>> +     if (pages >= (1 << (pageblock_order-1)) ||
>> +                     page_group_by_mobility_disabled)
>> +             set_pageblock_migratetype(page, start_type);
>> +}
>>
>> -             /* Claim the whole block if over half of it is free */
>> -             if (pages >= (1 << (pageblock_order-1)) ||
>> -                             page_group_by_mobility_disabled)
>> -                     set_pageblock_migratetype(page, start_type);
>> +static int find_suitable_fallback(struct free_area *area, unsigned int order,
>> +                                     int migratetype, bool *can_steal)
>
> Same here.

Okay.

>> +{
>> +     int i;
>> +     int fallback_mt;
>> +
>> +     if (area->nr_free == 0)
>> +             return -1;
>> +
>> +     *can_steal = false;
>> +     for (i = 0;; i++) {
>> +             fallback_mt = fallbacks[migratetype][i];
>> +             if (fallback_mt == MIGRATE_RESERVE)
>> +                     break;
>> +
>> +             if (list_empty(&area->free_list[fallback_mt]))
>> +                     continue;
>> +
>> +             if (can_steal_fallback(order, migratetype))
>> +                     *can_steal = true;
>> +
>> +             return i;
>
> You want to return fallback_mt, not 'i', no?

Yes. I will fix it.

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