[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAmzW4OW-gDsGgmSHzgE5R7GeLXYG78Gz6mhJJz9QPwPCchmiA@mail.gmail.com>
Date: Thu, 11 Feb 2016 10:58:26 +0900
From: Joonsoo Kim <js1304@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Vlastimil Babka <vbabka@...e.cz>, Aaron Lu <aaron.lu@...el.com>,
Mel Gorman <mgorman@...e.de>, Rik van Riel <riel@...hat.com>,
David Rientjes <rientjes@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
Joonsoo Kim <iamjoonsoo.kim@....com>
Subject: Re: [PATCH v2 3/3] mm/compaction: speed up pageblock_pfn_to_page()
when zone is contiguous
2016-02-11 3:58 GMT+09:00 Andrew Morton <akpm@...ux-foundation.org>:
> On Wed, 10 Feb 2016 14:42:57 +0100 Vlastimil Babka <vbabka@...e.cz> wrote:
>
>> > --- a/mm/memory_hotplug.c
>> > +++ b/mm/memory_hotplug.c
>> > @@ -509,6 +509,8 @@ int __ref __add_pages(int nid, struct zone *zone, unsigned long phys_start_pfn,
>> > int start_sec, end_sec;
>> > struct vmem_altmap *altmap;
>> >
>> > + clear_zone_contiguous(zone);
>> > +
>> > /* during initialize mem_map, align hot-added range to section */
>> > start_sec = pfn_to_section_nr(phys_start_pfn);
>> > end_sec = pfn_to_section_nr(phys_start_pfn + nr_pages - 1);
>> > @@ -540,6 +542,8 @@ int __ref __add_pages(int nid, struct zone *zone, unsigned long phys_start_pfn,
>> > }
>> > vmemmap_populate_print_last();
>> >
>> > + set_zone_contiguous(zone);
>> > +
>> > return err;
>> > }
>> > EXPORT_SYMBOL_GPL(__add_pages);
>>
>> Between the clear and set, __add_pages() might return with -EINVAL,
>> leaving the flag cleared potentially forever. Not critical, probably
>> rare, but it should be possible to avoid this by moving the clear below
>> the altmap check?
>
> um, yes. return-in-the-middle-of-a-function strikes again.
>
> --- a/mm/memory_hotplug.c~mm-compaction-speed-up-pageblock_pfn_to_page-when-zone-is-contiguous-fix
> +++ a/mm/memory_hotplug.c
> @@ -526,7 +526,8 @@ int __ref __add_pages(int nid, struct zo
> if (altmap->base_pfn != phys_start_pfn
> || vmem_altmap_offset(altmap) > nr_pages) {
> pr_warn_once("memory add fail, invalid altmap\n");
> - return -EINVAL;
> + err = -EINVAL;
> + goto out;
> }
> altmap->alloc = 0;
> }
> @@ -544,9 +545,8 @@ int __ref __add_pages(int nid, struct zo
> err = 0;
> }
> vmemmap_populate_print_last();
> -
> +out:
> set_zone_contiguous(zone);
> -
> return err;
> }
> EXPORT_SYMBOL_GPL(__add_pages);
Sorry for late response. I was on biggest holiday in Korea until now.
It seems that there is no issue left.
Andrew, Vlastimil, thanks for fixes and review.
Thanks.
Powered by blists - more mailing lists