lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111109000146.GA5075@redhat.com>
Date:	Wed, 9 Nov 2011 01:01:46 +0100
From:	Andrea Arcangeli <aarcange@...hat.com>
To:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
Cc:	"Rafael J. Wysocki" <rjw@...e.com>, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org, Jiri Slaby <jirislaby@...il.com>,
	linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] thp: reduce khugepaged freezing latency

On Wed, Nov 09, 2011 at 01:31:07AM +0530, Srivatsa S. Bhat wrote:
> On 11/08/2011 08:59 PM, Andrea Arcangeli wrote:
> > Lack of set_freezable_with_signal() prevented khugepaged to be waken
> > up (and prevented to sleep again) across the
> > schedule_timeout_interruptible() calls after freezing() becomes
> > true. The tight loop in khugepaged_alloc_hugepage() also missed one
> > try_to_freeze() call in case alloc_hugepage() would repeatedly fail in
> > turn preventing the loop to break and to reach the try_to_freeze() in
> > the khugepaged main loop.
> > 
> > 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@...e.cz>
> > Signed-off-by: Andrea Arcangeli <aarcange@...hat.com>
> > ---
> >  mm/huge_memory.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > index 4298aba..67311d1 100644
> > --- a/mm/huge_memory.c
> > +++ b/mm/huge_memory.c
> > @@ -2277,6 +2277,7 @@ static struct page *khugepaged_alloc_hugepage(void)
> >  		if (!hpage) {
> >  			count_vm_event(THP_COLLAPSE_ALLOC_FAILED);
> >  			khugepaged_alloc_sleep();
> > +			try_to_freeze();
> >  		} else
> >  			count_vm_event(THP_COLLAPSE_ALLOC);
> >  	} while (unlikely(!hpage) &&
> > @@ -2331,7 +2332,7 @@ static int khugepaged(void *none)
> >  {
> >  	struct mm_slot *mm_slot;
> > 
> > -	set_freezable();
> > +	set_freezable_with_signal();
> >  	set_user_nice(current, 19);
> > 
> >  	/* serialize with start_khugepaged() */
> > 
> 
> Why do we need to use both set_freezable_with_signal() and an additional
> try_to_freeze()? Won't just using either one of them be good enough?
> Or am I missing something here?

set_freezable_with_signal() makes khugepaged quit and not re-enter the
sleep, try_to_freeze is needed to get the task from freezing to
frozen, otherwise it'll loop without getting frozen.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ