linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Mel Gorman <mgorman@techsingularity.net>
Cc: ????????? <jaewon31.kim@samsung.com>,
	"vbabka@suse.cz" <vbabka@suse.cz>,
	"bhe@redhat.com" <bhe@redhat.com>,
	"minchan@kernel.org" <minchan@kernel.org>,
	"mgorman@suse.de" <mgorman@suse.de>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jaewon31.kim@gmail.com" <jaewon31.kim@gmail.com>,
	????????? <ytk.lee@samsung.com>,
	????????? <cmlaika.kim@samsung.com>
Subject: Re: [PATCH v4] page_alloc: consider highatomic reserve in watermark fast
Date: Mon, 22 Jun 2020 16:23:04 +0200	[thread overview]
Message-ID: <20200622142304.GD31426@dhcp22.suse.cz> (raw)
In-Reply-To: <20200622100439.GQ3183@techsingularity.net>

On Mon 22-06-20 11:04:39, Mel Gorman wrote:
> On Mon, Jun 22, 2020 at 06:40:20PM +0900, ????????? wrote:
> > >But more importantly, I have hard time to follow why we need both
> > >zone_watermark_fast and zone_watermark_ok now. They should be
> > >essentially the same for anything but order == 0. For order 0 the
> > >only difference between the two is that zone_watermark_ok checks for
> > >ALLOC_HIGH resp ALLOC_HARDER, ALLOC_OOM. So what is exactly fast about
> > >the former and why do we need it these days?
> > > 
> > 
> > I think the author, Mel, may ansewr. But I think the wmark_fast may
> > fast by 1) not checking more condition about wmark and 2) using inline
> > rather than function. According to description on commit 48ee5f3696f6,
> > it seems to bring about 4% improvement.
> > 
> 
> The original intent was that watermark checks were expensive as some of the
> calculations are only necessary when a zone is relatively low on memory
> and the check does not always have to be 100% accurate. This is probably
> still true given that __zone_watermark_ok() makes a number of calculations
> depending on alloc flags even if a zone is almost completely free.

OK, so we are talking about 
	if (alloc_flags & ALLOC_HIGH)
		min -= min / 2;

	if (unlikely((alloc_flags & (ALLOC_HARDER|ALLOC_OOM))) {
		/*
		 * OOM victims can try even harder than normal ALLOC_HARDER
		 * users on the grounds that it's definitely going to be in
		 * the exit path shortly and free memory. Any allocation it
		 * makes during the free path will be small and short-lived.
		 */
		if (alloc_flags & ALLOC_OOM)
			min -= min / 2;
		else
			min -= min / 4;
	}

Is this something even measurable and something that would justify a
complex code? If we really want to keep it even after these changes
which are making the two closer in the cost then can we have it
documented at least?
-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2020-06-22 14:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200619055816epcas1p184da90b01aff559fe3cd690ebcd921ca@epcas1p1.samsung.com>
2020-06-19 23:59 ` [PATCH v4] page_alloc: consider highatomic reserve in watermark fast Jaewon Kim
2020-06-19 12:42   ` Baoquan He
2020-06-22  8:55   ` Mel Gorman
2020-06-22  9:11   ` Michal Hocko
     [not found]   ` <CGME20200619055816epcas1p184da90b01aff559fe3cd690ebcd921ca@epcms1p6>
2020-06-22  9:40     ` 김재원
2020-06-22 10:04       ` Mel Gorman
2020-06-22 14:23         ` Michal Hocko [this message]
2020-06-22 16:25           ` Mel Gorman
2020-06-23  7:11             ` Michal Hocko
2022-09-13 13:09 yong
2022-09-13 13:54 ` Greg KH
2022-09-14  0:46   ` yong w
2022-09-16  9:40     ` Greg KH
     [not found]     ` <CGME20220916094017epcas1p1deed4041f897d2bf0e0486554d79b3af@epcms1p4>
2022-09-18  1:41       ` Jaewon Kim
2022-09-19 13:21         ` yong w

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=20200622142304.GD31426@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=cmlaika.kim@samsung.com \
    --cc=hannes@cmpxchg.org \
    --cc=jaewon31.kim@gmail.com \
    --cc=jaewon31.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mgorman@techsingularity.net \
    --cc=minchan@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=ytk.lee@samsung.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).