linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: Interactivity regression since v3.11 in mm/vmscan.c
@ 2014-06-07 12:35 zhdxzx
  2014-06-07 15:23 ` Felipe Contreras
  2014-06-07 18:24 ` Linus Torvalds
  0 siblings, 2 replies; 18+ messages in thread
From: zhdxzx @ 2014-06-07 12:35 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Michal Hocko, linux-kernel, linux-mm@kvack.org, Andrew Morton,
	Linus Torvalds, Mel Gorman, dhillf, hillf.zj

----- Original Message -----
From: Felipe Contreras <felipe.contreras@gmail.com>

>>On Fri, Jun 6, 2014 at 4:58 AM,  <zhdxzx@sina.com> wrote:
>> Alternatively can we try wait_iff_congested(zone, BLK_RW_ASYNC, HZ/10) ?
>>
> I see the same problem with that code.
>
The comments around the congestion_wait,
[1]
	 *
	 * Once a zone is flagged ZONE_WRITEBACK, kswapd will count the number
	 * of pages under pages flagged for immediate reclaim and stall if any
	 * are encountered in the nr_immediate check below.
	 */
	if (nr_writeback && nr_writeback == nr_taken)
		zone_set_flag(zone, ZONE_WRITEBACK);


[2]
		/*
		 * If dirty pages are scanned that are not queued for IO, it
		 * implies that flushers are not keeping up. In this case, flag
		 * the zone ZONE_TAIL_LRU_DIRTY and kswapd will start writing
		 * pages from reclaim context. It will forcibly stall in the
		 * next check.
		 */
		if (nr_unqueued_dirty == nr_taken)
			zone_set_flag(zone, ZONE_TAIL_LRU_DIRTY);

The "force stall" in [2] conflicts with "start writing pages" in [2], and
conflicts with "nr_immediate check below" in [1] as well, IIUC.

Would you please try again based only on comment [1](based on v3.15-rc8)?
thanks
Hillf

--- a/mm/vmscan.c	Sat Jun  7 18:38:08 2014
+++ b/mm/vmscan.c	Sat Jun  7 20:08:36 2014
@@ -1566,7 +1566,7 @@ shrink_inactive_list(unsigned long nr_to
 		 * implies that pages are cycling through the LRU faster than
 		 * they are written so also forcibly stall.
 		 */
-		if (nr_unqueued_dirty == nr_taken || nr_immediate)
+		if (nr_immediate)
 			congestion_wait(BLK_RW_ASYNC, HZ/10);
 	}
 
--

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Interactivity regression since v3.11 in mm/vmscan.c
@ 2014-06-06  9:58 zhdxzx
  2014-06-06 10:24 ` Felipe Contreras
  0 siblings, 1 reply; 18+ messages in thread
From: zhdxzx @ 2014-06-06  9:58 UTC (permalink / raw)
  To: Michal Hocko, Felipe Contreras
  Cc: linux-kernel, linux-mm@kvack.org, Andrew Morton, Linus Torvalds,
	Mel Gorman, dhillf

----- Original Message -----
From: Michal Hocko <mhocko@suse.cz>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, "linux-mm@kvack.org" <linux-mm@kvack.org>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, Mel Gorman <mgorman@suse.de>, KAMEZAWA Hiroyuki <kamezawa.hiro
Subject: Re: Interactivity regression since v3.11 in mm/vmscan.c
Date: 2014-06-06 17:16

On Thu 05-06-14 09:00:10, Felipe Contreras wrote:
> On Thu, Jun 5, 2014 at 8:37 AM, Michal Hocko <mhocko@suse.cz> wrote:
> > On Thu 05-06-14 06:33:40, Felipe Contreras wrote:
> 
> >> For a while I've noticed that my machine bogs down in certain
> >> situations, usually while doing heavy I/O operations, it is not just the
> >> I/O operations, but everything, including the graphical interface, even
> >> the mouse pointer.
> >>
> >> As far as I can recall this did not happen in the past.
> >>
> >> I noticed this specially on certain operations, for example updating a
> >> a game on Steam (to an exteranl USB 3.0 device), or copying TV episodes
> >> to a USB memory stick (probably flash-based).
> >
> > We had a similar report for opensuse. The common part was that there was
> > an IO to a slow USB device going on.
> 
> Well, it's a USB 3.0 device, I can write at 250 MB/s, so it's not
> really that slow.
> 
> And in fact, when I read and write to and from the same USB 3.0
> device, I don't see the issue.
> 
> >> Then I went back to the latest stable version (v3.14.5), and commented
> >> out the line I think is causing the slow down:
> >>
> >>   if (nr_unqueued_dirty == nr_taken || nr_immediate)
> >>         congestion_wait(BLK_RW_ASYNC, HZ/10);
> >
> > Yes, I came to the same check. I didn't have any confirmation yet so
> > thanks for your confirmation. I've suggested to reduce this
> > congestion_wait only to kswapd:
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 32c661d66a45..ef6a1c0e788c 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -1566,7 +1566,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
> >                  * implies that pages are cycling through the LRU faster than
> >                  * they are written so also forcibly stall.
> >                  */
> > -               if (nr_unqueued_dirty == nr_taken || nr_immediate)
> > +               if ((nr_unqueued_dirty == nr_taken || nr_immediate) && current_is_kswapd())
> >                         congestion_wait(BLK_RW_ASYNC, HZ/10);
> >         }
> 
> Unfortunately that doesn't fix the issue for me.
>That is really interesting. So removing the test completely helps but
>reducing it to kswapd doesn't. I would expect stalls coming from direct
>reclaimers not the kswapd.
>Mel has a nice systemtap script (attached) to watch for stalls. Maybe
>you can give it a try?
>
Alternatively can we try wait_iff_congested(zone, BLK_RW_ASYNC, HZ/10) ?

Hillf

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Interactivity regression since v3.11 in mm/vmscan.c
@ 2014-06-05 11:33 Felipe Contreras
  2014-06-05 13:37 ` Michal Hocko
  0 siblings, 1 reply; 18+ messages in thread
From: Felipe Contreras @ 2014-06-05 11:33 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: Andrew Morton, Linus Torvalds, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel

Hi,

For a while I've noticed that my machine bogs down in certain
situations, usually while doing heavy I/O operations, it is not just the
I/O operations, but everything, including the graphical interface, even
the mouse pointer.

As far as I can recall this did not happen in the past.

I noticed this specially on certain operations, for example updating a
a game on Steam (to an exteranl USB 3.0 device), or copying TV episodes
to a USB memory stick (probably flash-based).

Today I decided to finally hunt down the problem, so I created a
synthetic test that basically consists on copying a bunch of files from
one drive to another (from an SSD to an external USB 3.0). This is
pretty similar to what I noticed; the graphical interface slows down.

Then I bisected the issue and it turns out that indeed it wasn't
happening in the past, it started happening in v3.11, and it was
triggered by this commit:

  e2be15f (mm: vmscan: stall page reclaim and writeback pages based on
  dirty/writepage pages encountered)

Then I went back to the latest stable version (v3.14.5), and commented
out the line I think is causing the slow down:

  if (nr_unqueued_dirty == nr_taken || nr_immediate)
	  congestion_wait(BLK_RW_ASYNC, HZ/10);

After that I don't notice the slow down any more.

Anybody has any ideas how to fix the issue properly?

-- 
Felipe Contreras

--
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>

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-06-09 12:58 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-07 12:35 Interactivity regression since v3.11 in mm/vmscan.c zhdxzx
2014-06-07 15:23 ` Felipe Contreras
2014-06-07 18:24 ` Linus Torvalds
2014-06-08 21:33   ` Linus Torvalds
2014-06-09 12:58   ` Mel Gorman
  -- strict thread matches above, loose matches on Subject: below --
2014-06-06  9:58 zhdxzx
2014-06-06 10:24 ` Felipe Contreras
2014-06-05 11:33 Felipe Contreras
2014-06-05 13:37 ` Michal Hocko
2014-06-05 14:00   ` Felipe Contreras
2014-06-06  9:16     ` Michal Hocko
2014-06-06 10:33       ` Felipe Contreras
2014-06-06 11:03         ` Michal Hocko
2014-06-06 12:54           ` Felipe Contreras
2014-06-06 23:11         ` Felipe Contreras
2014-06-09  7:53           ` Michal Hocko
2014-06-09 10:02             ` Felipe Contreras
2014-06-06 12:27   ` Felipe Contreras

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).