All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: vinayak menon <vinayakm.list@gmail.com>
Cc: Vinayak Menon <vinmenon@codeaurora.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	mgorman@techsingularity.net, vbabka@suse.cz, mhocko@suse.com,
	Rik van Riel <riel@redhat.com>,
	vdavydov.dev@gmail.com, anton.vorontsov@linaro.org,
	Shiraz Hashim <shiraz.hashim@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: vmscan: do not pass reclaimed slab to vmpressure
Date: Tue, 31 Jan 2017 08:40:28 +0900	[thread overview]
Message-ID: <20170130234028.GA7942@bbox> (raw)
In-Reply-To: <CAOaiJ-m=X=8GpLCW-7wVkBmT=Gq9V9ocXtcXbmNNALffLepWeg@mail.gmail.com>

Hi Vinayak,
Sorry for late response. It was Lunar New Year holidays.

On Fri, Jan 27, 2017 at 01:43:23PM +0530, vinayak menon wrote:
> >
> > Thanks for the explain. However, such case can happen with THP page
> > as well as slab. In case of THP page, nr_scanned is 1 but nr_reclaimed
> > could be 512 so I think vmpressure should have a logic to prevent undeflow
> > regardless of slab shrinking.
> >
> I see. Going to send a vmpressure fix. But, wouldn't the THP case
> result in incorrect
> vmpressure reporting even if we fix the vmpressure underflow problem ?

If a THP page is reclaimed, it reports lower pressure due to bigger
reclaim ratio(ie, reclaimed/scanned) compared to normal pages but
it's not a problem, is it? Because VM reclaimed more memory than
expected so memory pressure isn't severe now.

> 
> >>
> >> >
> >> >> unsigned arithmetic results in the pressure value to be
> >> >> huge, thus resulting in a critical event being sent to
> >> >> root cgroup. Fix this by not passing the reclaimed slab
> >> >> count to vmpressure, with the assumption that vmpressure
> >> >> should show the actual pressure on LRU which is now
> >> >> diluted by adding reclaimed slab without a corresponding
> >> >> scanned value.
> >> >
> >> > I can't guess justfication of your assumption from the description.
> >> > Why do we consider only LRU pages for vmpressure? Could you elaborate
> >> > a bit?
> >> >
> >> When we encountered the false events from vmpressure, thought the problem
> >> could be that slab scanned is not included in sc->nr_scanned, like it is done
> >> for reclaimed. But later thought vmpressure works only on the scanned and
> >> reclaimed from LRU. I can explain what I understand, let me know if this is
> >> incorrect.
> >> vmpressure is an index which tells the pressure on LRU, and thus an
> >> indicator of thrashing. In shrink_node when we come out of the inner do-while
> >> loop after shrinking the lruvec, the scanned and reclaimed corresponds to the
> >> pressure felt on the LRUs which in turn indicates the pressure on VM. The
> >> moment we add the slab reclaimed pages to the reclaimed, we dilute the
> >> actual pressure felt on LRUs. When slab scanned/reclaimed is not included
> >> in the vmpressure, the values will indicate the actual pressure and if there
> >> were a lot of slab reclaimed pages it will result in lesser pressure
> >> on LRUs in the next run which will again be indicated by vmpressure. i.e. the
> >
> > I think there is no intention to exclude slab by design of vmpressure.
> > Beause slab is memory consumption so freeing of slab pages really helps
> > the memory pressure. Also, there might be slab-intensive workload rather
> > than LRU. It would be great if vmpressure works well with that case.
> > But the problem with involving slab for vmpressure is it's not fair with
> > LRU pages. LRU pages are 1:1 cost model for scan:free but slab shriking
> > depends the each slab's object population. It means it's impossible to
> > get stable cost model with current slab shrinkg model, unfortunately.
> > So I don't obejct this patch although I want to see slab shrink model's
> > change which is heavy-handed work.
> >
> Looking at the code, the slab reclaimed pages started getting passed to
> vmpressure after the commit ("mm: vmscan: invoke slab shrinkers from
> shrink_zone()").
> But as you said, this may be helpful for slab intensive workloads. But in its
> current form I think it results in incorrect vmpressure reporting because of not
> accounting the slab scanned pages. Resending the patch with a modified
> commit msg
> since the underflow issue is fixed separately. Thanks Minchan.

Make sense.

Thanks, Vinayak!

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

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: vinayak menon <vinayakm.list@gmail.com>
Cc: Vinayak Menon <vinmenon@codeaurora.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	<mgorman@techsingularity.net>, <vbabka@suse.cz>,
	<mhocko@suse.com>, Rik van Riel <riel@redhat.com>,
	<vdavydov.dev@gmail.com>, <anton.vorontsov@linaro.org>,
	Shiraz Hashim <shiraz.hashim@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: vmscan: do not pass reclaimed slab to vmpressure
Date: Tue, 31 Jan 2017 08:40:28 +0900	[thread overview]
Message-ID: <20170130234028.GA7942@bbox> (raw)
In-Reply-To: <CAOaiJ-m=X=8GpLCW-7wVkBmT=Gq9V9ocXtcXbmNNALffLepWeg@mail.gmail.com>

Hi Vinayak,
Sorry for late response. It was Lunar New Year holidays.

On Fri, Jan 27, 2017 at 01:43:23PM +0530, vinayak menon wrote:
> >
> > Thanks for the explain. However, such case can happen with THP page
> > as well as slab. In case of THP page, nr_scanned is 1 but nr_reclaimed
> > could be 512 so I think vmpressure should have a logic to prevent undeflow
> > regardless of slab shrinking.
> >
> I see. Going to send a vmpressure fix. But, wouldn't the THP case
> result in incorrect
> vmpressure reporting even if we fix the vmpressure underflow problem ?

If a THP page is reclaimed, it reports lower pressure due to bigger
reclaim ratio(ie, reclaimed/scanned) compared to normal pages but
it's not a problem, is it? Because VM reclaimed more memory than
expected so memory pressure isn't severe now.

> 
> >>
> >> >
> >> >> unsigned arithmetic results in the pressure value to be
> >> >> huge, thus resulting in a critical event being sent to
> >> >> root cgroup. Fix this by not passing the reclaimed slab
> >> >> count to vmpressure, with the assumption that vmpressure
> >> >> should show the actual pressure on LRU which is now
> >> >> diluted by adding reclaimed slab without a corresponding
> >> >> scanned value.
> >> >
> >> > I can't guess justfication of your assumption from the description.
> >> > Why do we consider only LRU pages for vmpressure? Could you elaborate
> >> > a bit?
> >> >
> >> When we encountered the false events from vmpressure, thought the problem
> >> could be that slab scanned is not included in sc->nr_scanned, like it is done
> >> for reclaimed. But later thought vmpressure works only on the scanned and
> >> reclaimed from LRU. I can explain what I understand, let me know if this is
> >> incorrect.
> >> vmpressure is an index which tells the pressure on LRU, and thus an
> >> indicator of thrashing. In shrink_node when we come out of the inner do-while
> >> loop after shrinking the lruvec, the scanned and reclaimed corresponds to the
> >> pressure felt on the LRUs which in turn indicates the pressure on VM. The
> >> moment we add the slab reclaimed pages to the reclaimed, we dilute the
> >> actual pressure felt on LRUs. When slab scanned/reclaimed is not included
> >> in the vmpressure, the values will indicate the actual pressure and if there
> >> were a lot of slab reclaimed pages it will result in lesser pressure
> >> on LRUs in the next run which will again be indicated by vmpressure. i.e. the
> >
> > I think there is no intention to exclude slab by design of vmpressure.
> > Beause slab is memory consumption so freeing of slab pages really helps
> > the memory pressure. Also, there might be slab-intensive workload rather
> > than LRU. It would be great if vmpressure works well with that case.
> > But the problem with involving slab for vmpressure is it's not fair with
> > LRU pages. LRU pages are 1:1 cost model for scan:free but slab shriking
> > depends the each slab's object population. It means it's impossible to
> > get stable cost model with current slab shrinkg model, unfortunately.
> > So I don't obejct this patch although I want to see slab shrink model's
> > change which is heavy-handed work.
> >
> Looking at the code, the slab reclaimed pages started getting passed to
> vmpressure after the commit ("mm: vmscan: invoke slab shrinkers from
> shrink_zone()").
> But as you said, this may be helpful for slab intensive workloads. But in its
> current form I think it results in incorrect vmpressure reporting because of not
> accounting the slab scanned pages. Resending the patch with a modified
> commit msg
> since the underflow issue is fixed separately. Thanks Minchan.

Make sense.

Thanks, Vinayak!

  reply	other threads:[~2017-01-30 23:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-25 11:38 [PATCH] mm: vmscan: do not pass reclaimed slab to vmpressure Vinayak Menon
2017-01-25 11:38 ` Vinayak Menon
2017-01-25 23:27 ` Minchan Kim
2017-01-25 23:27   ` Minchan Kim
2017-01-26  5:23   ` vinayak menon
2017-01-26  5:23     ` vinayak menon
2017-01-26 14:18     ` Minchan Kim
2017-01-26 14:18       ` Minchan Kim
2017-01-27  8:13       ` vinayak menon
2017-01-27  8:13         ` vinayak menon
2017-01-30 23:40         ` Minchan Kim [this message]
2017-01-30 23:40           ` Minchan Kim
2017-06-06 13:00           ` zhong jiang
2017-06-06 13:00             ` zhong jiang
2017-06-07  2:53             ` Minchan Kim
2017-06-07  2:53               ` Minchan Kim
2017-06-07  3:07               ` zhong jiang
2017-06-07  3:07                 ` zhong jiang

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=20170130234028.GA7942@bbox \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=anton.vorontsov@linaro.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=riel@redhat.com \
    --cc=shiraz.hashim@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=vdavydov.dev@gmail.com \
    --cc=vinayakm.list@gmail.com \
    --cc=vinmenon@codeaurora.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.