linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Charan Teja Reddy <charante@codeaurora.org>,
	akpm@linux-foundation.org, mcgrof@kernel.org,
	keescook@chromium.org, yzaikin@google.com,
	dave.hansen@linux.intel.com, mgorman@techsingularity.net,
	nigupta@nvidia.com, corbet@lwn.net, rppt@kernel.org,
	khalid.aziz@oracle.com, rientjes@google.com
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	vinmenon@codeaurora.org
Subject: Re: [PATCH V5] mm: compaction: support triggering of proactive compaction by user
Date: Fri, 30 Jul 2021 16:06:02 +0200	[thread overview]
Message-ID: <8fe4ba65-28e1-02d8-cf4d-74aaa76fe9df@suse.cz> (raw)
In-Reply-To: <1627653207-12317-1-git-send-email-charante@codeaurora.org>

On 7/30/21 3:53 PM, Charan Teja Reddy wrote:
> The proactive compaction[1] gets triggered for every 500msec and run
> compaction on the node for COMPACTION_HPAGE_ORDER (usually order-9)
> pages based on the value set to sysctl.compaction_proactiveness.
> Triggering the compaction for every 500msec in search of
> COMPACTION_HPAGE_ORDER pages is not needed for all applications,
> especially on the embedded system usecases which may have few MB's of
> RAM. Enabling the proactive compaction in its state will endup in
> running almost always on such systems.
> 
> Other side, proactive compaction can still be very much useful for
> getting a set of higher order pages in some controllable
> manner(controlled by using the sysctl.compaction_proactiveness). So, on
> systems where enabling the proactive compaction always may proove not
> required, can trigger the same from user space on write to its sysctl
> interface. As an example, say app launcher decide to launch the memory
> heavy application which can be launched fast if it gets more higher
> order pages thus launcher can prepare the system in advance by
> triggering the proactive compaction from userspace.
> 
> This triggering of proactive compaction is done on a write to
> sysctl.compaction_proactiveness by user.
> 
> [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=facdaa917c4d5a376d09d25865f5a863f906234a
> 
> Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>

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

> @@ -2895,9 +2920,16 @@ static int kcompactd(void *p)
>  	while (!kthread_should_stop()) {
>  		unsigned long pflags;
>  
> +		/*
> +		 * Avoid the unnecessary wakeup for proactive compaction
> +		 * when it is disabled.
> +		 */
> +		if (!sysctl_compaction_proactiveness)
> +			timeout = MAX_SCHEDULE_TIMEOUT;

Does this part actually logically belong more to your previous patch that
optimized the deferred timeouts?

>  		trace_mm_compaction_kcompactd_sleep(pgdat->node_id);
>  		if (wait_event_freezable_timeout(pgdat->kcompactd_wait,
> -			kcompactd_work_requested(pgdat), timeout)) {
> +			kcompactd_work_requested(pgdat), timeout) &&
> +			!pgdat->proactive_compact_trigger) {
>  
>  			psi_memstall_enter(&pflags);
>  			kcompactd_do_work(pgdat);
> @@ -2932,6 +2964,8 @@ static int kcompactd(void *p)
>  				timeout =
>  				   default_timeout << COMPACT_MAX_DEFER_SHIFT;
>  		}
> +		if (unlikely(pgdat->proactive_compact_trigger))
> +			pgdat->proactive_compact_trigger = false;
>  	}
>  
>  	return 0;
> 


  reply	other threads:[~2021-07-30 14:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 13:53 [PATCH V5] mm: compaction: support triggering of proactive compaction by user Charan Teja Reddy
2021-07-30 14:06 ` Vlastimil Babka [this message]
2021-07-30 14:46   ` Charan Teja Kalla
2021-07-30 14:47     ` Vlastimil Babka
2021-07-30 19:31 ` Mike Rapoport
2021-08-02 12:00   ` Charan Teja Kalla
2021-08-02 20:41     ` Andrew Morton
2021-08-04 21:11 ` Rafael Aquini

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=8fe4ba65-28e1-02d8-cf4d-74aaa76fe9df@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=charante@codeaurora.org \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=keescook@chromium.org \
    --cc=khalid.aziz@oracle.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mcgrof@kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=nigupta@nvidia.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=vinmenon@codeaurora.org \
    --cc=yzaikin@google.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).