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: <20140120204108.GE18196@sgi.com>
Date:	Mon, 20 Jan 2014 14:41:08 -0600
From:	Alex Thorlton <athorlton@....com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	"Kirill A. Shutemov" <kirill@...temov.name>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Rik van Riel <riel@...hat.com>,
	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Andy Lutomirski <luto@...capital.net>,
	Al Viro <viro@...iv.linux.org.uk>,
	Kees Cook <keescook@...omium.org>,
	Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [RFC PATCHv2 2/2] Change khugepaged to respect MMF_THP_DISABLE
 flag

On Mon, Jan 20, 2014 at 09:15:25PM +0100, Oleg Nesterov wrote:
> On 01/20, Alex Thorlton wrote:
> >
> > No, definitely not.  Upon review, khugepaged_test_exit is the wrong
> > place to do this check.  I think I need to move it up to
> > khugepaged_scan_mm_slot for this to work correctly.
> 
> Why? unless a MMF_THP_DISABLE task does madvise(MADV_HUGEPAGE)
> khugepaged_scan_mm_slot() should never see its ->mm ?
> 
> Although I got lost a bit, and probably misunderstood... but it
> seems to me that whatever you do this patch should not touch
> khugepaged_scan_mm_slot.

Maybe I've gotten myself confused as well :)  After looking through the
code some more, my understanding is that khugepaged_test_exit is used to
make sure that __khugepaged_exit isn't running from underneath at certain
times, so to have khugepaged_test_exit return true when __khugepaged_exit
is not necessarily running, seems incorrect to me.

I think the check for MMF_THP_DISABLE should occur at the same time as
we check khugepaged_test_exit, but should occur separately, since I
don't really believe the two checks are related.  Something like this in
khugepaged_scan_mm_slot:

        mm = mm_slot->mm;
        down_read(&mm->mmap_sem);
-       if (unlikely(khugepaged_test_exit(mm)))
+       if (unlikely(khugepaged_test_exit(mm) || check_mmf_thp_disable(mm)))
                vma = NULL;
        else
                vma = find_vma(mm, khugepaged_scan.address);

        progress++;

I think this makes more sense, but I may not be looking at this
correctly.  Thoughts?

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