Re: [PATCH] [PATCH] mm: disable preemption before swapcache_free
From: Michal Hocko
Date: Wed Jul 25 2018 - 03:40:15 EST
On Wed 25-07-18 14:37:58, zhaowuyun@xxxxxxxxxxxx wrote:
[...]
> Change-Id: I36d9df7ccff77c589b7157225410269c675a8504
What is this?
> Signed-off-by: zhaowuyun <zhaowuyun@xxxxxxxxxxxx>
> ---
> mm/vmscan.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 2740973..acede002 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -674,6 +674,12 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
> BUG_ON(!PageLocked(page));
> BUG_ON(mapping != page_mapping(page));
> + /*
> + * preemption must be disabled to protect current task preempted before
> + * swapcache_free(swap) invoked by the task which do the
> + * __read_swap_cache_async job on the same page
> + */
> + preempt_disable();
> spin_lock_irqsave(&mapping->tree_lock, flags);
Hmm, but spin_lock_irqsave already implies the disabled preemption.
--
Michal Hocko
SUSE Labs