All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michal Nazarewicz" <mina86@mina86.com>
To: "Marek Szyprowski" <m.szyprowski@samsung.com>,
	"Gilad Ben-Yossef" <gilad@benyossef.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, linux-mm@kvack.org,
	linaro-mm-sig@lists.linaro.org,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	"Russell King" <linux@arm.linux.org.uk>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com>,
	"Daniel Walker" <dwalker@codeaurora.org>,
	"Mel Gorman" <mel@csn.ul.ie>, "Arnd Bergmann" <arnd@arndb.de>,
	"Jesse Barker" <jesse.barker@linaro.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shariq Hasnain" <shariq.hasnain@linaro.org>,
	"Chunsang Jeong" <chunsang.jeong@linaro.org>,
	"Dave Hansen" <dave@linux.vnet.ibm.com>,
	"Benjamin Gaignard" <benjamin.gaignard@linaro.org>
Subject: Re: [PATCH 01/11] mm: page_alloc: set_migratetype_isolate: drain PCP prior to isolating
Date: Sun, 01 Jan 2012 16:54:38 +0100	[thread overview]
Message-ID: <op.v7ew5cvg3l0zgt@mpn-glaptop> (raw)
In-Reply-To: <CAOtvUMeAVgDwRNsDTcG07ChYnAuNgNJjQ+sKALJ79=Ezikos-A@mail.gmail.com>

> On Thu, Dec 29, 2011 at 2:39 PM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
>> From: Michal Nazarewicz <mina86@mina86.com>
>>
>> When set_migratetype_isolate() sets pageblock's migrate type, it does
>> not change each page_private data.  This makes sense, as the function
>> has no way of knowing what kind of information page_private stores.

>> A side effect is that instead of draining pages from all zones,
>> set_migratetype_isolate() now drain only pages from zone pageblock it
>> operates on is in.

>> +/* Caller must hold zone->lock. */
>> +static void __zone_drain_local_pages(void *arg)
>> +{
>> +       struct per_cpu_pages *pcp;
>> +       struct zone *zone = arg;
>> +       unsigned long flags;
>> +
>> +       local_irq_save(flags);
>> +       pcp = &per_cpu_ptr(zone->pageset, smp_processor_id())->pcp;
>> +       if (pcp->count) {
>> +               /* Caller holds zone->lock, no need to grab it. */
>> +               __free_pcppages_bulk(zone, pcp->count, pcp);
>> +               pcp->count = 0;
>> +       }
>> +       local_irq_restore(flags);
>> +}
>> +
>> +/*
>> + * Like drain_all_pages() but operates on a single zone.  Caller must
>> + * hold zone->lock.
>> + */
>> +static void __zone_drain_all_pages(struct zone *zone)
>> +{
>> +       on_each_cpu(__zone_drain_local_pages, zone, 1);
>> +}
>> +

On Sun, 01 Jan 2012 08:49:13 +0100, Gilad Ben-Yossef <gilad@benyossef.com> wrote:
> Please consider whether sending an IPI to all processors in the system
> and interrupting them is appropriate here.
>
> You seem to assume that it is probable that each CPU of the possibly
> 4,096 (MAXSMP on x86) has a per-cpu page for the specified zone,

I'm not really assuming that (in fact I expect what you fear, ie. that
most CPUs won't have pages from specified zone an PCP list), however,
I really need to make sure to get them off all PCP lists.

> otherwise you're just interrupting them out of doing something useful,
> or save power idle for nothing.

Exactly what's happening now anyway.

> While that may or may not be a reasonable assumption for the general
> drain_all_pages that drains pcps from all zones, I feel it is less
> likely to be the right thing once you limit the drain to a single
> zone.

Currently, set_migratetype_isolate() seem to do more then it needs to,
ie. it drains all the pages even though all it cares about is a single
zone.

> Some background on my attempt to reduce "IPI noise" in the system in
> this context is probably useful here as
> well: https://lkml.org/lkml/2011/11/22/133

Looks interesting, I'm not entirely sure why it does not end up a race
condition, but in case of __zone_drain_all_pages() we already hold
zone->lock, so my fears are somehow gone..  I'll give it a try, and prepare
a patch for __zone_drain_all_pages().

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--

WARNING: multiple messages have this Message-ID (diff)
From: "Michal Nazarewicz" <mina86@mina86.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	Gilad Ben-Yossef <gilad@benyossef.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, linux-mm@kvack.org,
	linaro-mm-sig@lists.linaro.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Russell King <linux@arm.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Daniel Walker <dwalker@codeaurora.org>,
	Mel Gorman <mel@csn.ul.ie>, Arnd Bergmann <arnd@arndb.de>,
	Jesse Barker <jesse.barker@linaro.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Shariq Hasnain <shariq.hasnain@linaro.org>,
	Chunsang Jeong <chunsang.jeong@linaro.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>
Subject: Re: [PATCH 01/11] mm: page_alloc: set_migratetype_isolate: drain PCP prior to isolating
Date: Sun, 01 Jan 2012 16:54:38 +0100	[thread overview]
Message-ID: <op.v7ew5cvg3l0zgt@mpn-glaptop> (raw)
In-Reply-To: <CAOtvUMeAVgDwRNsDTcG07ChYnAuNgNJjQ+sKALJ79=Ezikos-A@mail.gmail.com>

> On Thu, Dec 29, 2011 at 2:39 PM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
>> From: Michal Nazarewicz <mina86@mina86.com>
>>
>> When set_migratetype_isolate() sets pageblock's migrate type, it does
>> not change each page_private data.  This makes sense, as the function
>> has no way of knowing what kind of information page_private stores.

>> A side effect is that instead of draining pages from all zones,
>> set_migratetype_isolate() now drain only pages from zone pageblock it
>> operates on is in.

>> +/* Caller must hold zone->lock. */
>> +static void __zone_drain_local_pages(void *arg)
>> +{
>> +       struct per_cpu_pages *pcp;
>> +       struct zone *zone = arg;
>> +       unsigned long flags;
>> +
>> +       local_irq_save(flags);
>> +       pcp = &per_cpu_ptr(zone->pageset, smp_processor_id())->pcp;
>> +       if (pcp->count) {
>> +               /* Caller holds zone->lock, no need to grab it. */
>> +               __free_pcppages_bulk(zone, pcp->count, pcp);
>> +               pcp->count = 0;
>> +       }
>> +       local_irq_restore(flags);
>> +}
>> +
>> +/*
>> + * Like drain_all_pages() but operates on a single zone.  Caller must
>> + * hold zone->lock.
>> + */
>> +static void __zone_drain_all_pages(struct zone *zone)
>> +{
>> +       on_each_cpu(__zone_drain_local_pages, zone, 1);
>> +}
>> +

On Sun, 01 Jan 2012 08:49:13 +0100, Gilad Ben-Yossef <gilad@benyossef.com> wrote:
> Please consider whether sending an IPI to all processors in the system
> and interrupting them is appropriate here.
>
> You seem to assume that it is probable that each CPU of the possibly
> 4,096 (MAXSMP on x86) has a per-cpu page for the specified zone,

I'm not really assuming that (in fact I expect what you fear, ie. that
most CPUs won't have pages from specified zone an PCP list), however,
I really need to make sure to get them off all PCP lists.

> otherwise you're just interrupting them out of doing something useful,
> or save power idle for nothing.

Exactly what's happening now anyway.

> While that may or may not be a reasonable assumption for the general
> drain_all_pages that drains pcps from all zones, I feel it is less
> likely to be the right thing once you limit the drain to a single
> zone.

Currently, set_migratetype_isolate() seem to do more then it needs to,
ie. it drains all the pages even though all it cares about is a single
zone.

> Some background on my attempt to reduce "IPI noise" in the system in
> this context is probably useful here as
> well: https://lkml.org/lkml/2011/11/22/133

Looks interesting, I'm not entirely sure why it does not end up a race
condition, but in case of __zone_drain_all_pages() we already hold
zone->lock, so my fears are somehow gone..  I'll give it a try, and prepare
a patch for __zone_drain_all_pages().

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: mina86@mina86.com (Michal Nazarewicz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/11] mm: page_alloc: set_migratetype_isolate: drain PCP prior to isolating
Date: Sun, 01 Jan 2012 16:54:38 +0100	[thread overview]
Message-ID: <op.v7ew5cvg3l0zgt@mpn-glaptop> (raw)
In-Reply-To: <CAOtvUMeAVgDwRNsDTcG07ChYnAuNgNJjQ+sKALJ79=Ezikos-A@mail.gmail.com>

> On Thu, Dec 29, 2011 at 2:39 PM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
>> From: Michal Nazarewicz <mina86@mina86.com>
>>
>> When set_migratetype_isolate() sets pageblock's migrate type, it does
>> not change each page_private data.  This makes sense, as the function
>> has no way of knowing what kind of information page_private stores.

>> A side effect is that instead of draining pages from all zones,
>> set_migratetype_isolate() now drain only pages from zone pageblock it
>> operates on is in.

>> +/* Caller must hold zone->lock. */
>> +static void __zone_drain_local_pages(void *arg)
>> +{
>> +       struct per_cpu_pages *pcp;
>> +       struct zone *zone = arg;
>> +       unsigned long flags;
>> +
>> +       local_irq_save(flags);
>> +       pcp = &per_cpu_ptr(zone->pageset, smp_processor_id())->pcp;
>> +       if (pcp->count) {
>> +               /* Caller holds zone->lock, no need to grab it. */
>> +               __free_pcppages_bulk(zone, pcp->count, pcp);
>> +               pcp->count = 0;
>> +       }
>> +       local_irq_restore(flags);
>> +}
>> +
>> +/*
>> + * Like drain_all_pages() but operates on a single zone.  Caller must
>> + * hold zone->lock.
>> + */
>> +static void __zone_drain_all_pages(struct zone *zone)
>> +{
>> +       on_each_cpu(__zone_drain_local_pages, zone, 1);
>> +}
>> +

On Sun, 01 Jan 2012 08:49:13 +0100, Gilad Ben-Yossef <gilad@benyossef.com> wrote:
> Please consider whether sending an IPI to all processors in the system
> and interrupting them is appropriate here.
>
> You seem to assume that it is probable that each CPU of the possibly
> 4,096 (MAXSMP on x86) has a per-cpu page for the specified zone,

I'm not really assuming that (in fact I expect what you fear, ie. that
most CPUs won't have pages from specified zone an PCP list), however,
I really need to make sure to get them off all PCP lists.

> otherwise you're just interrupting them out of doing something useful,
> or save power idle for nothing.

Exactly what's happening now anyway.

> While that may or may not be a reasonable assumption for the general
> drain_all_pages that drains pcps from all zones, I feel it is less
> likely to be the right thing once you limit the drain to a single
> zone.

Currently, set_migratetype_isolate() seem to do more then it needs to,
ie. it drains all the pages even though all it cares about is a single
zone.

> Some background on my attempt to reduce "IPI noise" in the system in
> this context is probably useful here as
> well: https://lkml.org/lkml/2011/11/22/133

Looks interesting, I'm not entirely sure why it does not end up a race
condition, but in case of __zone_drain_all_pages() we already hold
zone->lock, so my fears are somehow gone..  I'll give it a try, and prepare
a patch for __zone_drain_all_pages().

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Micha? ?mina86? Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--

  reply	other threads:[~2012-01-01 15:55 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29 12:39 [PATCHv18 0/11] Contiguous Memory Allocator Marek Szyprowski
2011-12-29 12:39 ` Marek Szyprowski
2011-12-29 12:39 ` Marek Szyprowski
2011-12-29 12:39 ` [PATCH 01/11] mm: page_alloc: set_migratetype_isolate: drain PCP prior to isolating Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2012-01-01  7:49   ` Gilad Ben-Yossef
2012-01-01  7:49     ` Gilad Ben-Yossef
2012-01-01  7:49     ` Gilad Ben-Yossef
2012-01-01 15:54     ` Michal Nazarewicz [this message]
2012-01-01 15:54       ` Michal Nazarewicz
2012-01-01 15:54       ` Michal Nazarewicz
2012-01-01 16:06       ` Gilad Ben-Yossef
2012-01-01 16:06         ` Gilad Ben-Yossef
2012-01-01 16:06         ` Gilad Ben-Yossef
2012-01-01 18:52         ` Michal Nazarewicz
2012-01-01 18:52           ` Michal Nazarewicz
2012-01-01 18:52           ` Michal Nazarewicz
2012-01-05 15:39   ` Michal Nazarewicz
2012-01-05 15:39     ` Michal Nazarewicz
2012-01-05 15:39     ` Michal Nazarewicz
2012-01-05 19:20     ` Marek Szyprowski
2012-01-05 19:20       ` Marek Szyprowski
2012-01-05 19:20       ` Marek Szyprowski
2011-12-29 12:39 ` [PATCH 02/11] mm: compaction: introduce isolate_{free,migrate}pages_range() Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2012-01-10 13:43   ` Mel Gorman
2012-01-10 13:43     ` Mel Gorman
2012-01-10 13:43     ` Mel Gorman
2012-01-10 15:04     ` Michal Nazarewicz
2012-01-10 15:04       ` Michal Nazarewicz
2012-01-10 15:04       ` Michal Nazarewicz
2011-12-29 12:39 ` [PATCH 03/11] mm: compaction: export some of the functions Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39 ` [PATCH 04/11] mm: page_alloc: introduce alloc_contig_range() Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2012-01-10 14:16   ` Mel Gorman
2012-01-10 14:16     ` Mel Gorman
2012-01-10 14:16     ` Mel Gorman
2012-01-13 20:04     ` Michal Nazarewicz
2012-01-13 20:04       ` Michal Nazarewicz
2012-01-13 20:04       ` Michal Nazarewicz
2012-01-16  9:01       ` Mel Gorman
2012-01-16  9:01         ` Mel Gorman
2012-01-16  9:01         ` Mel Gorman
2012-01-16 12:48         ` Michal Nazarewicz
2012-01-16 12:48           ` Michal Nazarewicz
2012-01-16 12:48           ` Michal Nazarewicz
2012-01-17 21:54   ` [Linaro-mm-sig] " sandeep patil
2012-01-17 21:54     ` sandeep patil
2012-01-17 21:54     ` sandeep patil
2012-01-17 22:19     ` Michal Nazarewicz
2012-01-17 22:19       ` Michal Nazarewicz
2012-01-17 22:19       ` Michal Nazarewicz
2012-01-18  0:46       ` sandeep patil
2012-01-18  0:46         ` sandeep patil
2012-01-18  0:46         ` sandeep patil
2012-01-18  1:44         ` Michal Nazarewicz
2012-01-18  1:44           ` Michal Nazarewicz
2012-01-18  1:44           ` Michal Nazarewicz
2012-01-19  7:36     ` Marek Szyprowski
2012-01-19  7:36       ` Marek Szyprowski
2012-01-19  7:36       ` Marek Szyprowski
2011-12-29 12:39 ` [PATCH 05/11] mm: mmzone: MIGRATE_CMA migration type added Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2012-01-10 14:38   ` Mel Gorman
2012-01-10 14:38     ` Mel Gorman
2012-01-10 14:38     ` Mel Gorman
2012-01-10 15:04     ` Michal Nazarewicz
2012-01-10 15:04       ` Michal Nazarewicz
2012-01-10 15:04       ` Michal Nazarewicz
2011-12-29 12:39 ` [PATCH 06/11] mm: page_isolation: MIGRATE_CMA isolation functions added Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39 ` [PATCH 07/11] mm: add optional memory reclaim in split_free_page() Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2012-01-10 14:45   ` Mel Gorman
2012-01-10 14:45     ` Mel Gorman
2012-01-10 14:45     ` Mel Gorman
2011-12-29 12:39 ` [PATCH 08/11] drivers: add Contiguous Memory Allocator Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39 ` [PATCH 09/11] X86: integrate CMA with DMA-mapping subsystem Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39 ` [PATCH 10/11] ARM: " Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39 ` [PATCH 11/11] ARM: Samsung: use CMA for 2 memory banks for s5p-mfc device Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2011-12-29 12:39   ` Marek Szyprowski
2012-01-10  8:42 ` [PATCHv18 0/11] Contiguous Memory Allocator Marek Szyprowski
2012-01-10  8:42   ` Marek Szyprowski
2012-01-10  8:42   ` Marek Szyprowski

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=op.v7ew5cvg3l0zgt@mpn-glaptop \
    --to=mina86@mina86.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=benjamin.gaignard@linaro.org \
    --cc=chunsang.jeong@linaro.org \
    --cc=corbet@lwn.net \
    --cc=dave@linux.vnet.ibm.com \
    --cc=dwalker@codeaurora.org \
    --cc=gilad@benyossef.com \
    --cc=jesse.barker@linaro.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=mel@csn.ul.ie \
    --cc=shariq.hasnain@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.