On 6.5.2015 8:28, Joonsoo Kim wrote:
> On Tue, May 05, 2015 at 11:22:59AM +0800, Hui Zhu wrote:
>>
>> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
>> index 755a42c..eb22d1f 100644
>> --- a/mm/page_isolation.c
>> +++ b/mm/page_isolation.c
>> @@ -101,7 +101,8 @@ void unset_migratetype_isolate(struct page *page, 
>> unsigned migratetype)
>>                      buddy_idx = __find_buddy_index(page_idx, order);
>>                      buddy = page + (buddy_idx - page_idx);
>>  
>> -                    if (!is_migrate_isolate_page(buddy)) {
>> +                    if (!pfn_valid_within(page_to_pfn(buddy))
>> +                        || !is_migrate_isolate_page(buddy)) {
>>                              __isolate_free_page(page, order);
>>                              kernel_map_pages(page, (1 << order), 1);
>>                              set_page_refcounted(page);
> 
> Hello,
> 
> This isolation is for merging buddy pages. If buddy is not valid, we
> don't need to isolate page, because we can't merge them.
> I think that correct code would be:
> 
> pfn_valid_within(page_to_pfn(buddy)) &&
>         !is_migrate_isolate_page(buddy)
> 
> But, isolation and free here is safe operation so your code will work
> fine.

Ah damnit, you're right. But now you got me thinking about it more, and
paranoid... I thought I saw more bugs since the buddy might be in different zone
and we are not locking that zone, but then again it's probably fine, just very
tricky. Then I thought it could be simplified but then not again. Guess I'll
just run away fast :)

> Thanks.
> 

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

Reply via email to