From: Vlastimil Babka <vbabka@suse.cz> To: Hillf Danton <hillf.zj@alibaba-inc.com>, "'Mel Gorman'" <mgorman@techsingularity.net> Cc: "'Andrew Morton'" <akpm@linux-foundation.org>, "'Shantanu Goel'" <sgoel01@yahoo.com>, "'Chris Mason'" <clm@fb.com>, "'Johannes Weiner'" <hannes@cmpxchg.org>, "'LKML'" <linux-kernel@vger.kernel.org>, "'Linux-MM'" <linux-mm@kvack.org> Subject: Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx Date: Mon, 20 Feb 2017 17:34:21 +0100 [thread overview] Message-ID: <d4e3317b-5ae8-f61c-4d71-5a74a4014cc7@suse.cz> (raw) In-Reply-To: <001f01d2882d$9dd14850$d973d8f0$@alibaba-inc.com> On 02/16/2017 09:21 AM, Hillf Danton wrote: > > On February 16, 2017 4:11 PM Mel Gorman wrote: >> On Thu, Feb 16, 2017 at 02:23:08PM +0800, Hillf Danton wrote: >> > On February 15, 2017 5:23 PM Mel Gorman wrote: >> > > */ >> > > static int kswapd(void *p) >> > > { >> > > - unsigned int alloc_order, reclaim_order, classzone_idx; >> > > + unsigned int alloc_order, reclaim_order; >> > > + unsigned int classzone_idx = MAX_NR_ZONES - 1; >> > > pg_data_t *pgdat = (pg_data_t*)p; >> > > struct task_struct *tsk = current; >> > > >> > > @@ -3447,20 +3466,23 @@ static int kswapd(void *p) >> > > tsk->flags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; >> > > set_freezable(); >> > > >> > > - pgdat->kswapd_order = alloc_order = reclaim_order = 0; >> > > - pgdat->kswapd_classzone_idx = classzone_idx = 0; >> > > + pgdat->kswapd_order = 0; >> > > + pgdat->kswapd_classzone_idx = MAX_NR_ZONES; >> > > for ( ; ; ) { >> > > bool ret; >> > > >> > > + alloc_order = reclaim_order = pgdat->kswapd_order; >> > > + classzone_idx = kswapd_classzone_idx(pgdat, classzone_idx); >> > > + >> > > kswapd_try_sleep: >> > > kswapd_try_to_sleep(pgdat, alloc_order, reclaim_order, >> > > classzone_idx); >> > > >> > > /* Read the new order and classzone_idx */ >> > > alloc_order = reclaim_order = pgdat->kswapd_order; >> > > - classzone_idx = pgdat->kswapd_classzone_idx; >> > > + classzone_idx = kswapd_classzone_idx(pgdat, 0); >> > > pgdat->kswapd_order = 0; >> > > - pgdat->kswapd_classzone_idx = 0; >> > > + pgdat->kswapd_classzone_idx = MAX_NR_ZONES; >> > > >> > > ret = try_to_freeze(); >> > > if (kthread_should_stop()) >> > > @@ -3486,9 +3508,6 @@ static int kswapd(void *p) >> > > reclaim_order = balance_pgdat(pgdat, alloc_order, classzone_idx); >> > > if (reclaim_order < alloc_order) >> > > goto kswapd_try_sleep; >> > >> > If we fail order-5 request, can we then give up order-5, and >> > try order-3 if requested, after napping? >> > >> >> That has no bearing upon this patch. At this point, kswapd has stopped >> reclaiming at the requested order and is preparing to sleep. If there is >> a parallel request for order-3 while it's sleeping, it'll wake and start >> reclaiming at order-3 as requested. >> > Right, but the order-3 request can also come up while kswapd is active and > gives up order-5. "Giving up on order-5" means it will set sc.order to 0, go to sleep (assuming order-0 watermarks are OK) and wakeup kcompactd for order-5. There's no way how kswapd could help an order-3 allocation at that point - it's up to kcompactd. > thanks > Hillf >
WARNING: multiple messages have this Message-ID (diff)
From: Vlastimil Babka <vbabka@suse.cz> To: Hillf Danton <hillf.zj@alibaba-inc.com>, 'Mel Gorman' <mgorman@techsingularity.net> Cc: 'Andrew Morton' <akpm@linux-foundation.org>, 'Shantanu Goel' <sgoel01@yahoo.com>, 'Chris Mason' <clm@fb.com>, 'Johannes Weiner' <hannes@cmpxchg.org>, 'LKML' <linux-kernel@vger.kernel.org>, 'Linux-MM' <linux-mm@kvack.org> Subject: Re: [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx Date: Mon, 20 Feb 2017 17:34:21 +0100 [thread overview] Message-ID: <d4e3317b-5ae8-f61c-4d71-5a74a4014cc7@suse.cz> (raw) In-Reply-To: <001f01d2882d$9dd14850$d973d8f0$@alibaba-inc.com> On 02/16/2017 09:21 AM, Hillf Danton wrote: > > On February 16, 2017 4:11 PM Mel Gorman wrote: >> On Thu, Feb 16, 2017 at 02:23:08PM +0800, Hillf Danton wrote: >> > On February 15, 2017 5:23 PM Mel Gorman wrote: >> > > */ >> > > static int kswapd(void *p) >> > > { >> > > - unsigned int alloc_order, reclaim_order, classzone_idx; >> > > + unsigned int alloc_order, reclaim_order; >> > > + unsigned int classzone_idx = MAX_NR_ZONES - 1; >> > > pg_data_t *pgdat = (pg_data_t*)p; >> > > struct task_struct *tsk = current; >> > > >> > > @@ -3447,20 +3466,23 @@ static int kswapd(void *p) >> > > tsk->flags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; >> > > set_freezable(); >> > > >> > > - pgdat->kswapd_order = alloc_order = reclaim_order = 0; >> > > - pgdat->kswapd_classzone_idx = classzone_idx = 0; >> > > + pgdat->kswapd_order = 0; >> > > + pgdat->kswapd_classzone_idx = MAX_NR_ZONES; >> > > for ( ; ; ) { >> > > bool ret; >> > > >> > > + alloc_order = reclaim_order = pgdat->kswapd_order; >> > > + classzone_idx = kswapd_classzone_idx(pgdat, classzone_idx); >> > > + >> > > kswapd_try_sleep: >> > > kswapd_try_to_sleep(pgdat, alloc_order, reclaim_order, >> > > classzone_idx); >> > > >> > > /* Read the new order and classzone_idx */ >> > > alloc_order = reclaim_order = pgdat->kswapd_order; >> > > - classzone_idx = pgdat->kswapd_classzone_idx; >> > > + classzone_idx = kswapd_classzone_idx(pgdat, 0); >> > > pgdat->kswapd_order = 0; >> > > - pgdat->kswapd_classzone_idx = 0; >> > > + pgdat->kswapd_classzone_idx = MAX_NR_ZONES; >> > > >> > > ret = try_to_freeze(); >> > > if (kthread_should_stop()) >> > > @@ -3486,9 +3508,6 @@ static int kswapd(void *p) >> > > reclaim_order = balance_pgdat(pgdat, alloc_order, classzone_idx); >> > > if (reclaim_order < alloc_order) >> > > goto kswapd_try_sleep; >> > >> > If we fail order-5 request, can we then give up order-5, and >> > try order-3 if requested, after napping? >> > >> >> That has no bearing upon this patch. At this point, kswapd has stopped >> reclaiming at the requested order and is preparing to sleep. If there is >> a parallel request for order-3 while it's sleeping, it'll wake and start >> reclaiming at order-3 as requested. >> > Right, but the order-3 request can also come up while kswapd is active and > gives up order-5. "Giving up on order-5" means it will set sc.order to 0, go to sleep (assuming order-0 watermarks are OK) and wakeup kcompactd for order-5. There's no way how kswapd could help an order-3 allocation at that point - it's up to kcompactd. > thanks > Hillf > -- 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/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-02-20 16:34 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-15 9:22 [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Mel Gorman 2017-02-15 9:22 ` Mel Gorman 2017-02-15 9:22 ` [PATCH 1/3] mm, vmscan: fix zone balance check in prepare_kswapd_sleep Mel Gorman 2017-02-15 9:22 ` Mel Gorman 2017-02-16 2:50 ` Hillf Danton 2017-02-16 2:50 ` Hillf Danton 2017-02-22 7:00 ` Minchan Kim 2017-02-22 7:00 ` Minchan Kim 2017-02-23 15:05 ` Mel Gorman 2017-02-23 15:05 ` Mel Gorman 2017-02-24 1:17 ` Minchan Kim 2017-02-24 1:17 ` Minchan Kim 2017-02-24 9:11 ` Mel Gorman 2017-02-24 9:11 ` Mel Gorman 2017-02-27 6:16 ` Minchan Kim 2017-02-27 6:16 ` Minchan Kim 2017-02-15 9:22 ` [PATCH 2/3] mm, vmscan: Only clear pgdat congested/dirty/writeback state when balanced Mel Gorman 2017-02-15 9:22 ` Mel Gorman 2017-02-15 9:22 ` [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx Mel Gorman 2017-02-15 9:22 ` Mel Gorman 2017-02-16 6:23 ` Hillf Danton 2017-02-16 6:23 ` Hillf Danton 2017-02-16 8:10 ` Mel Gorman 2017-02-16 8:10 ` Mel Gorman 2017-02-16 8:21 ` Hillf Danton 2017-02-16 8:21 ` Hillf Danton 2017-02-16 9:32 ` Mel Gorman 2017-02-16 9:32 ` Mel Gorman 2017-02-20 16:34 ` Vlastimil Babka [this message] 2017-02-20 16:34 ` Vlastimil Babka 2017-02-21 4:10 ` Hillf Danton 2017-02-21 4:10 ` Hillf Danton 2017-02-20 16:42 ` Vlastimil Babka 2017-02-20 16:42 ` Vlastimil Babka 2017-02-23 15:01 ` Mel Gorman 2017-02-23 15:01 ` Mel Gorman 2017-03-01 9:04 ` Vlastimil Babka 2017-03-01 9:04 ` Vlastimil Babka 2017-02-15 20:30 ` [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely Andrew Morton 2017-02-15 20:30 ` Andrew Morton 2017-02-15 21:29 ` Mel Gorman 2017-02-15 21:29 ` Mel Gorman 2017-02-15 21:56 ` Andrew Morton 2017-02-15 21:56 ` Andrew Morton 2017-02-15 22:15 ` Mel Gorman 2017-02-15 22:15 ` Mel Gorman 2017-02-15 22:00 ` Vlastimil Babka 2017-02-15 22:00 ` Vlastimil Babka 2017-03-09 7:56 [PATCH 0/3] Reduce amount of time kswapd sleeps prematurely v2 Mel Gorman 2017-03-09 7:56 ` [PATCH 3/3] mm, vmscan: Prevent kswapd sleeping prematurely due to mismatched classzone_idx Mel Gorman 2017-03-09 7:56 ` Mel Gorman
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=d4e3317b-5ae8-f61c-4d71-5a74a4014cc7@suse.cz \ --to=vbabka@suse.cz \ --cc=akpm@linux-foundation.org \ --cc=clm@fb.com \ --cc=hannes@cmpxchg.org \ --cc=hillf.zj@alibaba-inc.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mgorman@techsingularity.net \ --cc=sgoel01@yahoo.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: linkBe 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.