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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <81d2df40-c955-b88d-e29f-7f09796f5deb@suse.cz>
Date:   Fri, 17 Jun 2022 09:55:37 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Yu Zhao <yuzhao@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     Marek Szyprowski <m.szyprowski@...sung.com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Nicolas Saenz Julienne <nsaenzju@...hat.com>,
        Marcelo Tosatti <mtosatti@...hat.com>,
        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 6/16/22 05:05, Yu Zhao wrote:
> On Wed, Jun 15, 2022 at 04:04:46PM -0700, Andrew Morton wrote:
> 
> While we are at it, please consider this cleanup:

I suspect Mel had further plans for the API beynd this series.

...

>  #define pcp_spin_trylock_irqsave(ptr, flags)				\
> -	pcpu_spin_trylock_irqsave(struct per_cpu_pages, lock, ptr, flags)
> -
> -#define pcp_spin_unlock(ptr)						\
> -	pcpu_spin_unlock(lock, ptr)
> +({									\
> +	struct per_cpu_pages *_ret;					\
> +	pcpu_task_pin();						\
> +	_ret = this_cpu_ptr(ptr);					\
> +	if (!spin_trylock_irqsave(&_ret->lock, flags))			\

Also missing the unpin?

> +		_ret = NULL;						\
> +	_ret;								\
> +})
>  
>  #define pcp_spin_unlock_irqrestore(ptr, flags)				\
> -	pcpu_spin_unlock_irqrestore(lock, ptr, flags)
> +({									\
> +	spin_unlock_irqrestore(&ptr->lock, flags);			\
> +	pcpu_task_unpin();						\
> +})
> +
>  #ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
>  DEFINE_PER_CPU(int, numa_node);
>  EXPORT_PER_CPU_SYMBOL(numa_node);
> @@ -3488,7 +3458,7 @@ void free_unref_page(struct page *page, unsigned int order)
>  
>  	zone = page_zone(page);
>  	pcp_trylock_prepare(UP_flags);
> -	pcp = pcpu_spin_trylock_irqsave(struct per_cpu_pages, lock, zone->per_cpu_pageset, flags);
> +	pcp = pcp_spin_trylock_irqsave(zone->per_cpu_pageset, flags);
>  	if (pcp) {
>  		free_unref_page_commit(pcp, zone, page, migratetype, order);
>  		pcp_spin_unlock_irqrestore(pcp, flags);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ