Re: [PATCH 7/7] mm/page_alloc: Replace local_lock with normal spinlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux