All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Minchan Kim <minchan@kernel.org>
Cc: Linux-MM <linux-mm@kvack.org>, Rik van Riel <riel@redhat.com>,
	Jim Schutt <jaschut@sandia.gov>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] mm: vmscan: Scale number of pages reclaimed by reclaim/compaction based on failures
Date: Thu, 9 Aug 2012 10:20:35 +0100	[thread overview]
Message-ID: <20120809092035.GD12690@suse.de> (raw)
In-Reply-To: <20120809082715.GA19802@bbox>

On Thu, Aug 09, 2012 at 05:27:15PM +0900, Minchan Kim wrote:
> > > > +      * pages reclaimed based on the number of consecutive allocation
> > > > +      * failures
> > > > +      */
> > > > +     zone = lruvec_zone(lruvec);
> > > > +     if (zone->compact_order_failed >= sc->order)
> > > 
> > > I can't understand this part.
> > > We don't defer lower order than compact_order_failed by aff62249.
> > > Do you mean lower order compaction context should be a lamb for
> > > deferred higher order allocation request success? I think it's not fair
> > > and even I can't understand rationale why it has to scale the number of pages
> > > reclaimed with the number of recent compaction failture.
> > > Your changelog just says "What we have to do, NOT Why we have to do".
> > > 
> > 
> > I'm a moron, that should be <=, not >=. All my tests were based on order==9
> > and that was the only order using reclaim/compaction so it happened to
> > work as expected. Thanks! I fixed that and added the following
> > clarification to the changelog
> > 
> > The rationale is that reclaiming the normal number of pages still allowed
> > compaction to fail and its success depends on the number of pages. If it's
> > failing, reclaim more pages until it succeeds again.
> > 
> > Does that make more sense?
> 
> If compaction is defered, requestors fails to get high-order page and
> they normally do fallback by order-0 or something.

Yes. At least, one hopes they fell back to order-0.

> In this context, if they don't depends on fallback and retrying higher order
> allocation, your patch makes sense to me because your algorithm is based on
> past allocation request fail rate.
> Do I miss something?

Your question is difficult to parse but I think you are making an implicit
assumption that it's the same caller retrying the high order allocation.
That is not the case, not do I want it to be because that would be similar
to the caller using __GFP_REPEAT. Retrying with more reclaim until the
allocation succeeds would both stall and reclaim excessively.

The intention is that an allocation can fail but each subsequent attempt will
try harder until there is success. Each allocation request does a portion
of the necessary work to spread the cost between multiple requests. Take
THP for example where there is a constant request for THP allocations
for whatever reason (heavy fork workload, large buffer allocation being
populated etc.). Some of those allocations fail but if they do, future
THP requests will reclaim more pages. When compaction resumes again, it
will be more likely to succeed and compact_defer_shift gets reset. In the
specific case of THP there will be allocations that fail but khugepaged
will promote them later if the process is long-lived.

-- 
Mel Gorman
SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mgorman@suse.de>
To: Minchan Kim <minchan@kernel.org>
Cc: Linux-MM <linux-mm@kvack.org>, Rik van Riel <riel@redhat.com>,
	Jim Schutt <jaschut@sandia.gov>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] mm: vmscan: Scale number of pages reclaimed by reclaim/compaction based on failures
Date: Thu, 9 Aug 2012 10:20:35 +0100	[thread overview]
Message-ID: <20120809092035.GD12690@suse.de> (raw)
In-Reply-To: <20120809082715.GA19802@bbox>

On Thu, Aug 09, 2012 at 05:27:15PM +0900, Minchan Kim wrote:
> > > > +      * pages reclaimed based on the number of consecutive allocation
> > > > +      * failures
> > > > +      */
> > > > +     zone = lruvec_zone(lruvec);
> > > > +     if (zone->compact_order_failed >= sc->order)
> > > 
> > > I can't understand this part.
> > > We don't defer lower order than compact_order_failed by aff62249.
> > > Do you mean lower order compaction context should be a lamb for
> > > deferred higher order allocation request success? I think it's not fair
> > > and even I can't understand rationale why it has to scale the number of pages
> > > reclaimed with the number of recent compaction failture.
> > > Your changelog just says "What we have to do, NOT Why we have to do".
> > > 
> > 
> > I'm a moron, that should be <=, not >=. All my tests were based on order==9
> > and that was the only order using reclaim/compaction so it happened to
> > work as expected. Thanks! I fixed that and added the following
> > clarification to the changelog
> > 
> > The rationale is that reclaiming the normal number of pages still allowed
> > compaction to fail and its success depends on the number of pages. If it's
> > failing, reclaim more pages until it succeeds again.
> > 
> > Does that make more sense?
> 
> If compaction is defered, requestors fails to get high-order page and
> they normally do fallback by order-0 or something.

Yes. At least, one hopes they fell back to order-0.

> In this context, if they don't depends on fallback and retrying higher order
> allocation, your patch makes sense to me because your algorithm is based on
> past allocation request fail rate.
> Do I miss something?

Your question is difficult to parse but I think you are making an implicit
assumption that it's the same caller retrying the high order allocation.
That is not the case, not do I want it to be because that would be similar
to the caller using __GFP_REPEAT. Retrying with more reclaim until the
allocation succeeds would both stall and reclaim excessively.

The intention is that an allocation can fail but each subsequent attempt will
try harder until there is success. Each allocation request does a portion
of the necessary work to spread the cost between multiple requests. Take
THP for example where there is a constant request for THP allocations
for whatever reason (heavy fork workload, large buffer allocation being
populated etc.). Some of those allocations fail but if they do, future
THP requests will reclaim more pages. When compaction resumes again, it
will be more likely to succeed and compact_defer_shift gets reset. In the
specific case of THP there will be allocations that fail but khugepaged
will promote them later if the process is long-lived.

-- 
Mel Gorman
SUSE Labs

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

  reply	other threads:[~2012-08-09  9:20 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07 12:31 [RFC PATCH 0/6] Improve hugepage allocation success rates under load Mel Gorman
2012-08-07 12:31 ` Mel Gorman
2012-08-07 12:31 ` [PATCH 1/6] mm: compaction: Update comment in try_to_compact_pages Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 13:19   ` Rik van Riel
2012-08-07 13:19     ` Rik van Riel
2012-08-07 23:25   ` Minchan Kim
2012-08-07 23:25     ` Minchan Kim
2012-08-07 12:31 ` [PATCH 2/6] mm: vmscan: Scale number of pages reclaimed by reclaim/compaction based on failures Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 13:23   ` Rik van Riel
2012-08-07 13:23     ` Rik van Riel
2012-08-08  1:48   ` Minchan Kim
2012-08-08  1:48     ` Minchan Kim
2012-08-08  7:55     ` Mel Gorman
2012-08-08  7:55       ` Mel Gorman
2012-08-08  8:27       ` Minchan Kim
2012-08-08  8:27         ` Minchan Kim
2012-08-08  8:51         ` Mel Gorman
2012-08-08  8:51           ` Mel Gorman
2012-08-08 23:51           ` Minchan Kim
2012-08-08 23:51             ` Minchan Kim
2012-08-09  7:49             ` Mel Gorman
2012-08-09  7:49               ` Mel Gorman
2012-08-09  8:27               ` Minchan Kim
2012-08-09  8:27                 ` Minchan Kim
2012-08-09  9:20                 ` Mel Gorman [this message]
2012-08-09  9:20                   ` Mel Gorman
2012-08-09 20:29                   ` Rik van Riel
2012-08-09 20:29                     ` Rik van Riel
2012-08-10  8:14                     ` Mel Gorman
2012-08-10  8:14                       ` Mel Gorman
2012-08-09 23:27                   ` Minchan Kim
2012-08-09 23:27                     ` Minchan Kim
2012-08-10  8:34                     ` Mel Gorman
2012-08-10  8:34                       ` Mel Gorman
2012-08-10  8:48                       ` Minchan Kim
2012-08-10  8:48                         ` Minchan Kim
2012-08-07 12:31 ` [PATCH 3/6] mm: kswapd: Continue reclaiming for reclaim/compaction if the minimum number of pages have not been reclaimed Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 13:26   ` Rik van Riel
2012-08-07 13:26     ` Rik van Riel
2012-08-08  2:07   ` Minchan Kim
2012-08-08  2:07     ` Minchan Kim
2012-08-08  9:07     ` Mel Gorman
2012-08-08  9:07       ` Mel Gorman
2012-08-08  9:58       ` Mel Gorman
2012-08-08  9:58         ` Mel Gorman
2012-08-07 12:31 ` [PATCH 4/6] mm: compaction: Capture a suitable high-order page immediately when it is made available Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 13:30   ` Rik van Riel
2012-08-07 13:30     ` Rik van Riel
2012-08-07 12:31 ` [PATCH 5/6] mm: have order > 0 compaction start off where it left Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 12:31 ` [PATCH 6/6] mm: have order > 0 compaction start near a pageblock with free pages Mel Gorman
2012-08-07 12:31   ` Mel Gorman
2012-08-07 14:45   ` Rik van Riel
2012-08-07 14:45     ` Rik van Riel
2012-08-07 14:52     ` Mel Gorman
2012-08-07 14:52       ` Mel Gorman
2012-08-07 15:20       ` Jim Schutt
2012-08-07 15:20         ` Jim Schutt
2012-08-07 15:45         ` Mel Gorman
2012-08-07 15:45           ` Mel Gorman
2012-08-08  4:36   ` Minchan Kim
2012-08-08  4:36     ` Minchan Kim
2012-08-08 10:18     ` Mel Gorman
2012-08-08 10:18       ` 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=20120809092035.GD12690@suse.de \
    --to=mgorman@suse.de \
    --cc=jaschut@sandia.gov \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=riel@redhat.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 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.