All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Petr Mladek <pmladek@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	David Rientjes <rientjes@google.com>,
	Ebru Akagunduz <ebru.akagunduz@gmail.com>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-pm@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH] mm/khugepaged: Allow to interrupt allocation sleep again
Date: Tue, 25 Aug 2015 11:08:24 +0200	[thread overview]
Message-ID: <55DC3088.7050701@suse.cz> (raw)
In-Reply-To: <1440429203-4039-1-git-send-email-pmladek@suse.com>

On 08/24/2015 05:13 PM, Petr Mladek wrote:
> The commit 1dfb059b9438633b0546 ("thp: reduce khugepaged freezing
> latency") fixed khugepaged to do not block a system suspend. But
> the result is that it could not get interrupted before the given
> timeout because the condition for the wait event is "false".
>
> This patch puts back the original approach but it uses
> freezable_schedule_timeout_interruptible() instead of
> schedule_timeout_interruptible(). It does the right thing.
> I am pretty sure that the freezable variant was not used in
> the original fix only because it was not available at that time.
>
> The regression has been there for ages. It was not critical. It just
> did the allocation throttling a little bit more aggressively.
>
> I found this problem when converting the kthread to kthread worker API
> and trying to understand the code.
>
> Signed-off-by: Petr Mladek <pmladek@suse.com>

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

> ---
>   mm/huge_memory.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 7109330c5911..eb115aaa429c 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2368,8 +2368,12 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page,
>
>   static void khugepaged_alloc_sleep(void)
>   {
> -	wait_event_freezable_timeout(khugepaged_wait, false,
> -			msecs_to_jiffies(khugepaged_alloc_sleep_millisecs));
> +	DEFINE_WAIT(wait);
> +
> +	add_wait_queue(&khugepaged_wait, &wait);
> +	freezable_schedule_timeout_interruptible(
> +		msecs_to_jiffies(khugepaged_alloc_sleep_millisecs));
> +	remove_wait_queue(&khugepaged_wait, &wait);
>   }
>
>   static int khugepaged_node_load[MAX_NUMNODES];
>


WARNING: multiple messages have this Message-ID (diff)
From: Vlastimil Babka <vbabka@suse.cz>
To: Petr Mladek <pmladek@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	David Rientjes <rientjes@google.com>,
	Ebru Akagunduz <ebru.akagunduz@gmail.com>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-pm@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH] mm/khugepaged: Allow to interrupt allocation sleep again
Date: Tue, 25 Aug 2015 11:08:24 +0200	[thread overview]
Message-ID: <55DC3088.7050701@suse.cz> (raw)
In-Reply-To: <1440429203-4039-1-git-send-email-pmladek@suse.com>

On 08/24/2015 05:13 PM, Petr Mladek wrote:
> The commit 1dfb059b9438633b0546 ("thp: reduce khugepaged freezing
> latency") fixed khugepaged to do not block a system suspend. But
> the result is that it could not get interrupted before the given
> timeout because the condition for the wait event is "false".
>
> This patch puts back the original approach but it uses
> freezable_schedule_timeout_interruptible() instead of
> schedule_timeout_interruptible(). It does the right thing.
> I am pretty sure that the freezable variant was not used in
> the original fix only because it was not available at that time.
>
> The regression has been there for ages. It was not critical. It just
> did the allocation throttling a little bit more aggressively.
>
> I found this problem when converting the kthread to kthread worker API
> and trying to understand the code.
>
> Signed-off-by: Petr Mladek <pmladek@suse.com>

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

> ---
>   mm/huge_memory.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 7109330c5911..eb115aaa429c 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2368,8 +2368,12 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page,
>
>   static void khugepaged_alloc_sleep(void)
>   {
> -	wait_event_freezable_timeout(khugepaged_wait, false,
> -			msecs_to_jiffies(khugepaged_alloc_sleep_millisecs));
> +	DEFINE_WAIT(wait);
> +
> +	add_wait_queue(&khugepaged_wait, &wait);
> +	freezable_schedule_timeout_interruptible(
> +		msecs_to_jiffies(khugepaged_alloc_sleep_millisecs));
> +	remove_wait_queue(&khugepaged_wait, &wait);
>   }
>
>   static int khugepaged_node_load[MAX_NUMNODES];
>

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

  parent reply	other threads:[~2015-08-25  9:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 15:13 [PATCH] mm/khugepaged: Allow to interrupt allocation sleep again Petr Mladek
2015-08-24 15:13 ` Petr Mladek
2015-08-24 20:30 ` Andrew Morton
2015-08-24 20:30   ` Andrew Morton
2015-08-25  8:42   ` Petr Mladek
2015-08-25  9:12     ` Vlastimil Babka
2015-08-25  9:08 ` Vlastimil Babka [this message]
2015-08-25  9:08   ` Vlastimil Babka

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=55DC3088.7050701@suse.cz \
    --to=vbabka@suse.cz \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=ebru.akagunduz@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=pmladek@suse.com \
    --cc=rientjes@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 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.