linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: arunks@codeaurora.org, "K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	jgross@suse.com, Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Michal Hocko <mhocko@suse.com>,
	iamjoonsoo.kim@lge.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Oscar Salvador <osalvador@suse.de>,
	Mathieu Malaterre <malat@debian.org>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	jrdr.linux@gmail.com, Yasuaki Ishimatsu <yasu.isimatu@gmail.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	aaron.lu@intel.com, devel@linuxdriverproject.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	xen-devel@lists.xenproject.org, vatsa@codeaurora.org,
	Vinayak Menon <vinmenon@codeaurora.org>,
	getarunks@gmail.com
Subject: Re: [PATCH v5 1/2] memory_hotplug: Free pages as higher order
Date: Tue, 20 Nov 2018 06:15:39 +0800	[thread overview]
Message-ID: <CADZGycYeB_sZmsFJ-RV5LQavHZNJTv1_pTrnpRjs7owhYSNKSA@mail.gmail.com> (raw)
In-Reply-To: <97d8db4c-f117-8216-5f48-d5991692c867@suse.cz>

On Thu, Oct 11, 2018 at 6:05 PM Vlastimil Babka <vbabka@suse.cz> wrote:
>
> On 10/10/18 6:56 PM, Arun KS wrote:
> > On 2018-10-10 21:00, Vlastimil Babka wrote:
> >> On 10/5/18 10:10 AM, Arun KS wrote:
> >>> When free pages are done with higher order, time spend on
> >>> coalescing pages by buddy allocator can be reduced. With
> >>> section size of 256MB, hot add latency of a single section
> >>> shows improvement from 50-60 ms to less than 1 ms, hence
> >>> improving the hot add latency by 60%. Modify external
> >>> providers of online callback to align with the change.
> >>>
> >>> Signed-off-by: Arun KS <arunks@codeaurora.org>
> >>
> >> [...]
> >>
> >>> @@ -655,26 +655,44 @@ void __online_page_free(struct page *page)
> >>>  }
> >>>  EXPORT_SYMBOL_GPL(__online_page_free);
> >>>
> >>> -static void generic_online_page(struct page *page)
> >>> +static int generic_online_page(struct page *page, unsigned int order)
> >>>  {
> >>> -   __online_page_set_limits(page);
> >>
> >> This is now not called anymore, although the xen/hv variants still do
> >> it. The function seems empty these days, maybe remove it as a followup
> >> cleanup?
> >>
> >>> -   __online_page_increment_counters(page);
> >>> -   __online_page_free(page);
> >>> +   __free_pages_core(page, order);
> >>> +   totalram_pages += (1UL << order);
> >>> +#ifdef CONFIG_HIGHMEM
> >>> +   if (PageHighMem(page))
> >>> +           totalhigh_pages += (1UL << order);
> >>> +#endif
> >>
> >> __online_page_increment_counters() would have used
> >> adjust_managed_page_count() which would do the changes under
> >> managed_page_count_lock. Are we safe without the lock? If yes, there
> >> should perhaps be a comment explaining why.
> >
> > Looks unsafe without managed_page_count_lock. I think better have a
> > similar implementation of free_boot_core() in memory_hotplug.c like we
> > had in version 1 of patch. And use adjust_managed_page_count() instead
> > of page_zone(page)->managed_pages += nr_pages;
> >
> > https://lore.kernel.org/patchwork/patch/989445/
>
> Looks like deferred_free_range() has the same problem calling
> __free_pages_core() to adjust zone->managed_pages. I expect
> __free_pages_bootmem() is OK because at that point the system is still
> single-threaded?
> Could be solved by moving that out of __free_pages_core().
>

Seems deferred_free_range() is protected by
pgdat_resize_lock()/pgdat_resize_unlock().

Which protects pgdat's zones, if I am right.

> But do we care about readers potentially seeing a store tear? If yes
> then maybe these counters should be converted to atomics...
>
> > -static void generic_online_page(struct page *page)
> > +static int generic_online_page(struct page *page, unsigned int order)
> >   {
> > -     __online_page_set_limits(page);
> > -     __online_page_increment_counters(page);
> > -     __online_page_free(page);
> > +     unsigned long nr_pages = 1 << order;
> > +     struct page *p = page;
> > +
> > +     for (loop = 0 ; loop < nr_pages ; loop++, p++) {
> > +             __ClearPageReserved(p);
> > +             set_page_count(p, 0);
> > +     }
> > +
> > +     adjust_managed_page_count(page, nr_pages);
> > +     set_page_refcounted(page);
> > +     __free_pages(page, order);
> > +
> > +     return 0;
> > +}
> >
> >
> > Regards,
> > Arun
> >
>

      parent reply	other threads:[~2018-11-19 22:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05  8:10 [PATCH v5 1/2] memory_hotplug: Free pages as higher order Arun KS
2018-10-05  8:10 ` [PATCH v5 2/2] mm/page_alloc: remove software prefetching in __free_pages_core Arun KS
2018-10-09  9:30   ` Michal Hocko
2018-10-10 16:36   ` Vlastimil Babka
2018-10-08  7:34 ` [PATCH v5 1/2] memory_hotplug: Free pages as higher order Oscar Salvador
2018-10-09  9:29 ` Michal Hocko
2018-10-09  9:54   ` Arun KS
2018-10-09 11:06     ` Michal Hocko
2018-10-10  8:07 ` Oscar Salvador
2018-10-10 10:51   ` Arun KS
2018-10-10 11:01     ` Oscar Salvador
2018-10-10 15:30 ` Vlastimil Babka
2018-10-10 16:56   ` Arun KS
2018-10-10 17:33     ` Michal Hocko
2018-10-11  2:29       ` Arun KS
2018-10-11  7:55         ` Michal Hocko
2018-10-19  2:18           ` Andrew Morton
2018-10-19  8:07             ` Michal Hocko
2018-10-22 10:33               ` Arun KS
2018-11-05  9:42                 ` Arun KS
2018-11-05 21:44                   ` Andrew Morton
2018-11-06  5:31                     ` Arun KS
2018-10-11  8:07     ` Vlastimil Babka
2018-10-11  8:15       ` Michal Hocko
2018-11-19 22:15       ` Wei Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADZGycYeB_sZmsFJ-RV5LQavHZNJTv1_pTrnpRjs7owhYSNKSA@mail.gmail.com \
    --to=richard.weiyang@gmail.com \
    --cc=aaron.lu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arunks@codeaurora.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=devel@linuxdriverproject.org \
    --cc=getarunks@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jgross@suse.com \
    --cc=jrdr.linux@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=malat@debian.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=sthemmin@microsoft.com \
    --cc=vatsa@codeaurora.org \
    --cc=vbabka@suse.cz \
    --cc=vinmenon@codeaurora.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yasu.isimatu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).