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: <c00a1b621850fedaea3da01ab178e91b79f1dce5.camel@redhat.com>
Date:   Tue, 21 Jun 2022 11:31:41 +0200
From:   Nicolas Saenz Julienne <nsaenzju@...hat.com>
To:     Mel Gorman <mgorman@...hsingularity.net>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Marcelo Tosatti <mtosatti@...hat.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Michal Hocko <mhocko@...nel.org>,
        Hugh Dickins <hughd@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux-MM <linux-mm@...ck.org>
Subject: Re: [PATCH 7/7] mm/page_alloc: Replace local_lock with normal
 spinlock

On Tue, 2022-06-21 at 10:29 +0100, Mel Gorman wrote:
> On Fri, Jun 17, 2022 at 11:39:03AM +0200, Nicolas Saenz Julienne wrote:
> > Hi Mel,
> > 
> > On Mon, 2022-06-13 at 13:56 +0100, Mel Gorman wrote:
> > > @@ -3446,12 +3490,16 @@ void free_unref_page(struct page *page, unsigned int order)
> > >  		migratetype = MIGRATE_MOVABLE;
> > >  	}
> > >  
> > > -	local_lock_irqsave(&pagesets.lock, flags);
> > > -	freed_pcp = free_unref_page_commit(page, migratetype, order, false);
> > > -	local_unlock_irqrestore(&pagesets.lock, flags);
> > > -
> > > -	if (unlikely(!freed_pcp))
> > > +	zone = page_zone(page);
> > > +	pcp_trylock_prepare(UP_flags);
> > 
> > Now that you're calling the *_irqsave() family of function you can drop
> > pcp_trylock_prepare/finish()
> > 
> > For the record in UP:
> > 
> > #define spin_trylock_irqsave(lock, flags) \
> > ({ \
> > 	local_irq_save(flags); \
> > 	1;
> > })
> > 
> 
> The missing patch that is deferred for a later release uses spin_trylock
> so unless that is never merged because there is an unfixable flaw in it,
> I'd prefer to leave the preparation in place.
> 
> > > +	pcp = pcpu_spin_trylock_irqsave(struct per_cpu_pages, lock, zone->per_cpu_pageset, flags);
> > > +	if (pcp) {
> > > +		free_unref_page_commit(pcp, zone, page, migratetype, order);
> > > +		pcp_spin_unlock_irqrestore(pcp, flags);
> > > +	} else {
> > >  		free_one_page(page_zone(page), page, pfn, order, migratetype, FPI_NONE);
> > > +	}
> > > +	pcp_trylock_finish(UP_flags);
> > >  }
> > >  
> > >  /*
> > 
> > As Vlastimil mentioned elsewhere, I also wonder if it makes sense to just
> > bypass patch #5. Especially as its intent isn't true anymore:
> > 
> > "As preparation for dealing with both of those problems, protect the lists
> > with a spinlock.  The IRQ-unsafe version of the lock is used because IRQs
> > are already disabled by local_lock_irqsave.  spin_trylock is used in
> > preparation for a time when local_lock could be used instead of
> > lock_lock_irqsave."
> > 
> 
> It's still true, the patch just isn't included as I wanted them to be
> separated by time so a bisection that points to it is "obvious" instead
> of pointing at the whole series as being a potential problem.

Understood, I jumped straight into the code and missed your comment in the
cover letter.

Thanks!

-- 
Nicolás Sáenz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ