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: <YEnXllhPEQhT0CRt@dhcp22.suse.cz>
Date:   Thu, 11 Mar 2021 09:40:54 +0100
From:   Michal Hocko <mhocko@...e.com>
To:     "Paul E. McKenney" <paulmck@...nel.org>
Cc:     Mike Kravetz <mike.kravetz@...cle.com>,
        Muchun Song <songmuchun@...edance.com>, corbet@....net,
        tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
        hpa@...or.com, dave.hansen@...ux.intel.com, luto@...nel.org,
        peterz@...radead.org, viro@...iv.linux.org.uk,
        akpm@...ux-foundation.org, mchehab+huawei@...nel.org,
        pawan.kumar.gupta@...ux.intel.com, rdunlap@...radead.org,
        oneukum@...e.com, anshuman.khandual@....com, jroedel@...e.de,
        almasrymina@...gle.com, rientjes@...gle.com, willy@...radead.org,
        osalvador@...e.de, song.bao.hua@...ilicon.com, david@...hat.com,
        naoya.horiguchi@....com, joao.m.martins@...cle.com,
        duanxiongchun@...edance.com, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org, Chen Huang <chenhuang5@...wei.com>,
        Bodeddula Balasubramaniam <bodeddub@...zon.com>
Subject: Re: [PATCH v18 4/9] mm: hugetlb: alloc the vmemmap pages associated
 with each HugeTLB page

On Wed 10-03-21 15:28:51, Paul E. McKenney wrote:
> On Wed, Mar 10, 2021 at 02:10:12PM -0800, Mike Kravetz wrote:
> > On 3/10/21 1:49 PM, Paul E. McKenney wrote:
> > > On Wed, Mar 10, 2021 at 10:11:22PM +0100, Michal Hocko wrote:
> > >> On Wed 10-03-21 10:56:08, Mike Kravetz wrote:
> > >>> On 3/10/21 7:19 AM, Michal Hocko wrote:
> > >>>> On Mon 08-03-21 18:28:02, Muchun Song wrote:
> > >>>> [...]
> > >>>>> @@ -1447,7 +1486,7 @@ void free_huge_page(struct page *page)
> > >>>>>  	/*
> > >>>>>  	 * Defer freeing if in non-task context to avoid hugetlb_lock deadlock.
> > >>>>>  	 */
> > >>>>> -	if (!in_task()) {
> > >>>>> +	if (in_atomic()) {
> > >>>>
> > >>>> As I've said elsewhere in_atomic doesn't work for CONFIG_PREEMPT_COUNT=n.
> > >>>> We need this change for other reasons and so it would be better to pull
> > >>>> it out into a separate patch which also makes HUGETLB depend on
> > >>>> PREEMPT_COUNT.
> > >>>
> > >>> Yes, the issue of calling put_page for hugetlb pages from any context
> > >>> still needs work.  IMO, that is outside the scope of this series.  We
> > >>> already have code in this path which blocks/sleeps.
> > >>>
> > >>> Making HUGETLB depend on PREEMPT_COUNT is too restrictive.  IIUC,
> > >>> PREEMPT_COUNT will only be enabled if we enable:
> > >>> PREEMPT "Preemptible Kernel (Low-Latency Desktop)"
> > >>> PREEMPT_RT "Fully Preemptible Kernel (Real-Time)"
> > >>> or, other 'debug' options.  These are not enabled in 'more common'
> > >>> kernels.  Of course, we do not want to disable HUGETLB in common
> > >>> configurations.
> > >>
> > >> I haven't tried that but PREEMPT_COUNT should be selectable even without
> > >> any change to the preemption model (e.g. !PREEMPT).
> > > 
> > > It works reliably for me, for example as in the diff below.  So,
> > > as Michal says, you should be able to add "select PREEMPT_COUNT" to
> > > whatever Kconfig option you need to.
> > > 
> > 
> > Thanks Paul.
> > 
> > I may have been misreading Michal's suggestion of "make HUGETLB depend on
> > PREEMPT_COUNT".  We could "select PREEMPT_COUNT" if HUGETLB is enabled.
> > However, since HUGETLB is enabled in most configs, then this would
> > result in PREEMPT_COUNT also being enabled in most configs.  I honestly
> > do not know how much this will cost us?  I assume that if it was free or
> > really cheap it would already be always on?
> 
> There are a -lot- of configs out there, so are you sure that HUGETLB is
> really enabled in most of them?  ;-)

It certainly is enabled for all distribution kernels and many are
!PREEMPT so I believe this is what Mike was concerned about.

> More seriously, I was going by earlier emails in this and related threads
> plus Michal's "PREEMPT_COUNT should be selectable".  But there are other
> situations that would like PREEMPT_COUNT.  And to your point, some who
> would rather PREEMPT_COUNT not be universally enabled.  I haven't seen
> any performance or kernel-size numbers from any of them, however.

Yeah per cpu preempt counting shouldn't be noticeable but I have to
confess I haven't benchmarked it.
-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ