All of lore.kernel.org
 help / color / mirror / Atom feed
* question: should_compact_retry limit
@ 2019-06-04 23:30 Mike Kravetz
  2019-06-05  7:58 ` Vlastimil Babka
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Kravetz @ 2019-06-04 23:30 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: Vlastimil Babka, Michal Hocko

While looking at some really long hugetlb page allocation times, I noticed
instances where should_compact_retry() was returning true more often that
I expected.  In one allocation attempt, it returned true 765668 times in a
row.  To me, this was unexpected because of the following:

#define MAX_COMPACT_RETRIES 16
int max_retries = MAX_COMPACT_RETRIES;

However, if should_compact_retry() returns true via the following path we
do not increase the retry count.

	/*
	 * make sure the compaction wasn't deferred or didn't bail out early
	 * due to locks contention before we declare that we should give up.
	 * But do not retry if the given zonelist is not suitable for
	 * compaction.
	 */
	if (compaction_withdrawn(compact_result)) {
		ret = compaction_zonelist_suitable(ac, order, alloc_flags);
		goto out;
	}

Just curious, is this intentional?
-- 
Mike Kravetz

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

* Re: question: should_compact_retry limit
  2019-06-04 23:30 question: should_compact_retry limit Mike Kravetz
@ 2019-06-05  7:58 ` Vlastimil Babka
  2019-06-05 16:05   ` Mike Kravetz
  0 siblings, 1 reply; 4+ messages in thread
From: Vlastimil Babka @ 2019-06-05  7:58 UTC (permalink / raw)
  To: Mike Kravetz, linux-mm, linux-kernel; +Cc: Michal Hocko

On 6/5/19 1:30 AM, Mike Kravetz wrote:
> While looking at some really long hugetlb page allocation times, I noticed
> instances where should_compact_retry() was returning true more often that
> I expected.  In one allocation attempt, it returned true 765668 times in a
> row.  To me, this was unexpected because of the following:
> 
> #define MAX_COMPACT_RETRIES 16
> int max_retries = MAX_COMPACT_RETRIES;
> 
> However, if should_compact_retry() returns true via the following path we
> do not increase the retry count.
> 
> 	/*
> 	 * make sure the compaction wasn't deferred or didn't bail out early
> 	 * due to locks contention before we declare that we should give up.
> 	 * But do not retry if the given zonelist is not suitable for
> 	 * compaction.
> 	 */
> 	if (compaction_withdrawn(compact_result)) {
> 		ret = compaction_zonelist_suitable(ac, order, alloc_flags);
> 		goto out;
> 	}
> 
> Just curious, is this intentional?

Hmm I guess we didn't expect compaction_withdrawn() to be so
consistently returned. Do you know what value of compact_result is there
in your test?

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

* Re: question: should_compact_retry limit
  2019-06-05  7:58 ` Vlastimil Babka
@ 2019-06-05 16:05   ` Mike Kravetz
  2019-06-05 16:33     ` Vlastimil Babka
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Kravetz @ 2019-06-05 16:05 UTC (permalink / raw)
  To: Vlastimil Babka, linux-mm, linux-kernel; +Cc: Michal Hocko

On 6/5/19 12:58 AM, Vlastimil Babka wrote:
> On 6/5/19 1:30 AM, Mike Kravetz wrote:
>> While looking at some really long hugetlb page allocation times, I noticed
>> instances where should_compact_retry() was returning true more often that
>> I expected.  In one allocation attempt, it returned true 765668 times in a
>> row.  To me, this was unexpected because of the following:
>>
>> #define MAX_COMPACT_RETRIES 16
>> int max_retries = MAX_COMPACT_RETRIES;
>>
>> However, if should_compact_retry() returns true via the following path we
>> do not increase the retry count.
>>
>> 	/*
>> 	 * make sure the compaction wasn't deferred or didn't bail out early
>> 	 * due to locks contention before we declare that we should give up.
>> 	 * But do not retry if the given zonelist is not suitable for
>> 	 * compaction.
>> 	 */
>> 	if (compaction_withdrawn(compact_result)) {
>> 		ret = compaction_zonelist_suitable(ac, order, alloc_flags);
>> 		goto out;
>> 	}
>>
>> Just curious, is this intentional?
> 
> Hmm I guess we didn't expect compaction_withdrawn() to be so
> consistently returned. Do you know what value of compact_result is there
> in your test?

Added some instrumentation to record values and ran test,

557904 Total

549186 COMPACT_DEFERRED
  8718 COMPACT_PARTIAL_SKIPPED

Do note that this is not my biggest problem with these allocations.  That is
should_continue_reclaim returning true more often that in should.  Still
trying to get more info on that.  This was just something curious I also
discovered.
-- 
Mike Kravetz

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

* Re: question: should_compact_retry limit
  2019-06-05 16:05   ` Mike Kravetz
@ 2019-06-05 16:33     ` Vlastimil Babka
  0 siblings, 0 replies; 4+ messages in thread
From: Vlastimil Babka @ 2019-06-05 16:33 UTC (permalink / raw)
  To: Mike Kravetz, linux-mm, linux-kernel; +Cc: Michal Hocko

On 6/5/19 6:05 PM, Mike Kravetz wrote:
> On 6/5/19 12:58 AM, Vlastimil Babka wrote:
>> On 6/5/19 1:30 AM, Mike Kravetz wrote:
>> Hmm I guess we didn't expect compaction_withdrawn() to be so
>> consistently returned. Do you know what value of compact_result is there
>> in your test?
> 
> Added some instrumentation to record values and ran test,
> 
> 557904 Total
> 
> 549186 COMPACT_DEFERRED

Retrying mindlessly with compaction deferred sounds definitely wrong,
I'll try to look at it. Thanks.

>   8718 COMPACT_PARTIAL_SKIPPED
> 
> Do note that this is not my biggest problem with these allocations.  That is
> should_continue_reclaim returning true more often that in should.  Still
> trying to get more info on that.  This was just something curious I also
> discovered.
> 


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

end of thread, other threads:[~2019-06-05 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 23:30 question: should_compact_retry limit Mike Kravetz
2019-06-05  7:58 ` Vlastimil Babka
2019-06-05 16:05   ` Mike Kravetz
2019-06-05 16:33     ` Vlastimil Babka

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.