From: Charan Teja Kalla <charante@codeaurora.org>
To: Vlastimil Babka <vbabka@suse.cz>,
akpm@linux-foundation.org, nigupta@nvidia.com,
hannes@cmpxchg.org, corbet@lwn.net, mcgrof@kernel.org,
keescook@chromium.org, yzaikin@google.com, aarcange@redhat.com,
cl@linux.com, xi.fengfei@h3c.com, mchehab+huawei@kernel.org,
andrew.a.klychkov@gmail.com, dave.hansen@linux.intel.com,
bhe@redhat.com, iamjoonsoo.kim@lge.com, mateusznosek0@gmail.com,
sh_def@163.com, vinmenon@codeaurora.org
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] mm: compaction: support triggering of proactive compaction by user
Date: Thu, 17 Jun 2021 21:35:52 +0530 [thread overview]
Message-ID: <8d91a81b-09f3-e814-c9ce-16ff246ed359@codeaurora.org> (raw)
In-Reply-To: <0d516cfa-f41c-5ccc-26aa-67871f23dcd3@suse.cz>
Thanks Vlastimil !!
On 6/17/2021 8:07 PM, Vlastimil Babka wrote:
> On 6/17/21 9:30 AM, Charan Teja Kalla wrote:
>> Thanks Vlastimil for your inputs!!
>>
>> On 6/16/2021 5:29 PM, Vlastimil Babka wrote:
>>>> 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>
>>>> ---
>>>> changes in V2:
>>> You forgot to also summarize the changes. Please do in next version.
>>
>> I think we can get rid off 'proactive_defer' thread variable with the
>> timeout approach you suggested. But it is still requires to have one
>> additional variable 'proactive_compact_trigger', which main purpose is
>> to decide if the kcompactd wakeup is for proactive compaction or not.
>> Please see below code:
>> if (wait_event_freezable_timeout() && !proactive_compact_trigger) {
>> // do the non-proactive work
>> continue
>> }
>> // do the proactive work
>> .................
>>
>> Thus I feel that on writing new proactiveness, it is required to do
>> wakeup_kcomppactd() + set a flag that this wakeup is for proactive work.
>>
>> Am I failed to get your point here?
>
> The check whether to do non-proactive work is already guarded by
> kcompactd_work_requested(), which looks at pgdat->kcompactd_max_order and this
> is set by wakeup_kcompactd().
>
> So with a plain wakeup where we don't set pgdat->kcompactd_max_order will make
> it consider proactive work instead and we don't need another trigger variable
> AFAICS.
The wait_event/freezable_timeout() documentation says that:
* Returns:
* 0 if the @condition evaluated to %false after the @timeout elapsed,
or
* 1 if the @condition evaluated to %true after the @timeout elapsed,
* or the remaining jiffies (at least 1) if the @condition evaluated
* to %true before the @timeout elapsed.
which means the condition must be evaluated to true or timeout should be
elapsed for the function wait_event_freezable_timeout() to return.
Please check the macro implementation of __wait_event, where it will be
in for(;;) till the condition is evaluated to true or timeout happens.
#define __wait_event_freezable_timeout(wq_head, condition, timeout)
___wait_event(wq_head, ___wait_cond_timeout(condition),
TASK_INTERRUPTIBLE, 0, timeout,
__ret = freezable_schedule_timeout(__ret))
Thus the plain wakeup of kcompactd don't do the proactive compact work.
And so we should identify its wakeup for proactive work with a separate
flag.
>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2021-06-17 16:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 10:54 [PATCH V3 0/2] mm: compaction: proactive compaction trigger by user Charan Teja Reddy
2021-05-31 10:54 ` [PATCH v3 1/2] mm: compaction: support triggering of proactive compaction " Charan Teja Reddy
2021-06-07 10:38 ` Charan Teja Kalla
2021-06-14 14:57 ` Charan Teja Kalla
2021-06-16 11:59 ` Vlastimil Babka
2021-06-17 7:30 ` Charan Teja Kalla
2021-06-17 14:37 ` Vlastimil Babka
2021-06-17 16:05 ` Charan Teja Kalla [this message]
2021-06-17 16:17 ` Vlastimil Babka
2021-05-31 10:54 ` [PATCH v3 2/2] mm: compaction: fix wakeup logic of proactive compaction Charan Teja Reddy
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=8d91a81b-09f3-e814-c9ce-16ff246ed359@codeaurora.org \
--to=charante@codeaurora.org \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andrew.a.klychkov@gmail.com \
--cc=bhe@redhat.com \
--cc=cl@linux.com \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=keescook@chromium.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mateusznosek0@gmail.com \
--cc=mcgrof@kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=nigupta@nvidia.com \
--cc=sh_def@163.com \
--cc=vbabka@suse.cz \
--cc=vinmenon@codeaurora.org \
--cc=xi.fengfei@h3c.com \
--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).