linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>,
	Charan Teja Reddy <charante@codeaurora.org>
Cc: rientjes@google.com, nigupta@nvidia.com, khalid.aziz@oracle.com,
	vinmenon@codeaurora.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH resend] mm: compaction: optimize proactive compaction deferrals
Date: Wed, 21 Jul 2021 23:29:02 +0200	[thread overview]
Message-ID: <a693d1b0-e249-cca5-c910-5fbfd8f1a11c@suse.cz> (raw)
In-Reply-To: <20210721131806.5898dab3e329940fd8bd2db6@linux-foundation.org>

On 7/21/21 10:18 PM, Andrew Morton wrote:
> On Wed, 21 Jul 2021 17:43:19 +0530 Charan Teja Reddy <charante@codeaurora.org> wrote:
> 
>> Vlastimil Babka figured out that when fragmentation score didn't go down
>> across the proactive compaction i.e. when no progress is made, next wake
>> up for proactive compaction is deferred for 1 <<
>> COMPACT_MAX_DEFER_SHIFT, i.e. 64 times, with each wakeup interval of
>> HPAGE_FRAG_CHECK_INTERVAL_MSEC(=500). In each of this wakeup, it just
>> decrement 'proactive_defer' counter and goes sleep i.e. it is getting
>> woken to just decrement a counter. The same deferral time can also
>> achieved by simply doing the HPAGE_FRAG_CHECK_INTERVAL_MSEC <<
>> COMPACT_MAX_DEFER_SHIFT thus unnecessary wakeup of kcompact thread is
>> avoided thus also removes the need of 'proactive_defer' thread counter.

Acked-by: Vlastimil Babka <vbabka@suse.cz>

>>
>> @@ -2902,23 +2903,30 @@ static int kcompactd(void *p)
>>  
>>  		trace_mm_compaction_kcompactd_sleep(pgdat->node_id);
>>  		if (wait_event_freezable_timeout(pgdat->kcompactd_wait,
>> -			kcompactd_work_requested(pgdat),
>> -			msecs_to_jiffies(HPAGE_FRAG_CHECK_INTERVAL_MSEC))) {
>> +			kcompactd_work_requested(pgdat), timeout)) {
>>  
>>  			psi_memstall_enter(&pflags);
>>  			kcompactd_do_work(pgdat);
>>  			psi_memstall_leave(&pflags);
>> +			/*
>> +			 * Reset the timeout value. The defer timeout by
>> +			 * proactive compaction can effectively lost
>> +			 * here but that is fine as the condition of the
>> +			 * zone changed substantionally and carrying on
>> +			 * with the previous defer is not useful.
>> +			 */
>> +			timeout = default_timeout;
>>  			continue;
> 
> I find this comment hard to follow.  Is this better?

Yes, thanks.

> --- a/mm/compaction.c~mm-compaction-optimize-proactive-compaction-deferrals-fix
> +++ a/mm/compaction.c
> @@ -2909,11 +2909,11 @@ static int kcompactd(void *p)
>  			kcompactd_do_work(pgdat);
>  			psi_memstall_leave(&pflags);
>  			/*
> -			 * Reset the timeout value. The defer timeout by
> -			 * proactive compaction can effectively lost
> -			 * here but that is fine as the condition of the
> -			 * zone changed substantionally and carrying on
> -			 * with the previous defer is not useful.
> +			 * Reset the timeout value. The defer timeout from
> +			 * proactive compaction is lost here but that is fine
> +			 * as the condition of the zone changing substantionally
> +			 * then carrying on with the previous defer interval is
> +			 * not useful.
>  			 */
>  			timeout = default_timeout;
>  			continue;
> _
> 



  reply	other threads:[~2021-07-21 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 12:13 Charan Teja Reddy
2021-07-21 20:18 ` Andrew Morton
2021-07-21 21:29   ` Vlastimil Babka [this message]
2021-07-21 22:35 ` Khalid Aziz
2021-07-26  1:47 ` David Rientjes

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=a693d1b0-e249-cca5-c910-5fbfd8f1a11c@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=charante@codeaurora.org \
    --cc=khalid.aziz@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nigupta@nvidia.com \
    --cc=rientjes@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox