From: Jiri Slaby <jirislaby@gmail.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Tejun Heo <tj@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
"Rafael J. Wysocki" <rjw@suse.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] thp: reduce khugepaged freezing latency
Date: Fri, 11 Nov 2011 13:20:19 +0100 [thread overview]
Message-ID: <4EBD1303.9040402@gmail.com> (raw)
In-Reply-To: <20111109194047.GO5075@redhat.com>
On 11/09/2011 08:40 PM, Andrea Arcangeli wrote:
> On Wed, Nov 09, 2011 at 10:34:47AM -0800, Tejun Heo wrote:
>> know. My instinct tells me to strongly recommend use of
>> wait_event_freezable_timeout() and run away. :)
>
> Passing false wasn't so appealing to me but ok. Jiri can you test this
> with some suspend? (beware builds but untested)
>
> ===
> From: Andrea Arcangeli <aarcange@redhat.com>
> Subject: thp: reduce khugepaged freezing latency
>
> Use wait_event_freezable_timeout() instead of
> schedule_timeout_interruptible() to avoid missing freezer wakeups. A
> try_to_freeze() would have been needed in the
> khugepaged_alloc_hugepage tight loop too in case of the allocation
> failing repeatedly, and wait_event_freezable_timeout will provide it
> too.
>
> khugepaged would still freeze just fine by trying again the next
> minute but it's better if it freezes immediately.
>
> Reported-by: Jiri Slaby <jslaby@suse.cz>
Tested-by: Jiri Slaby <jslaby@suse.cz>
> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
> ---
> mm/huge_memory.c | 14 ++++----------
> 1 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 4298aba..fd925d0 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2259,12 +2259,9 @@ static void khugepaged_do_scan(struct page **hpage)
>
> static void khugepaged_alloc_sleep(void)
> {
> - DEFINE_WAIT(wait);
> - add_wait_queue(&khugepaged_wait, &wait);
> - schedule_timeout_interruptible(
> - msecs_to_jiffies(
> - khugepaged_alloc_sleep_millisecs));
> - remove_wait_queue(&khugepaged_wait, &wait);
> + wait_event_freezable_timeout(khugepaged_wait, false,
> + msecs_to_jiffies(
> + khugepaged_alloc_sleep_millisecs));
> }
>
> #ifndef CONFIG_NUMA
> @@ -2313,14 +2310,11 @@ static void khugepaged_loop(void)
> if (unlikely(kthread_should_stop()))
> break;
> if (khugepaged_has_work()) {
> - DEFINE_WAIT(wait);
> if (!khugepaged_scan_sleep_millisecs)
> continue;
> - add_wait_queue(&khugepaged_wait, &wait);
> - schedule_timeout_interruptible(
> + wait_event_freezable_timeout(khugepaged_wait, false,
> msecs_to_jiffies(
> khugepaged_scan_sleep_millisecs));
> - remove_wait_queue(&khugepaged_wait, &wait);
> } else if (khugepaged_enabled())
> wait_event_freezable(khugepaged_wait,
> khugepaged_wait_event());
thanks,
--
js
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-11-11 12:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 8:33 khugepaged doesn't want to freeze Jiri Slaby
2011-11-08 15:29 ` Andrea Arcangeli
2011-11-08 15:29 ` [PATCH] thp: reduce khugepaged freezing latency Andrea Arcangeli
2011-11-08 20:01 ` Srivatsa S. Bhat
2011-11-09 0:01 ` Andrea Arcangeli
2011-11-09 9:03 ` Srivatsa S. Bhat
2011-11-09 12:45 ` Srivatsa S. Bhat
2011-11-09 15:53 ` Tejun Heo
2011-11-09 16:20 ` Srivatsa S. Bhat
2011-11-09 16:52 ` Andrea Arcangeli
2011-11-09 16:59 ` Tejun Heo
2011-11-09 17:02 ` Tejun Heo
2011-11-09 17:29 ` Andrea Arcangeli
2011-11-09 18:09 ` Tejun Heo
2011-11-09 18:19 ` Andrea Arcangeli
2011-11-09 18:34 ` Tejun Heo
2011-11-09 19:40 ` Andrea Arcangeli
2011-11-11 12:20 ` Jiri Slaby [this message]
2011-11-09 17:06 ` Tejun Heo
2011-11-09 17:33 ` Andrea Arcangeli
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=4EBD1303.9040402@gmail.com \
--to=jirislaby@gmail.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pm@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=rjw@suse.com \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=tj@kernel.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;
as well as URLs for NNTP newsgroup(s).