Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1613307 > unrolled thread

Re: [PATCH 4/4] mm/vmalloc: remove vfree_atomic()

Started byMatthew Wilcox <willy@infradead.org>
First post2017-03-30 19:20 +0200
Last post2017-03-30 19:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 4/4] mm/vmalloc: remove vfree_atomic() Matthew Wilcox <willy@infradead.org> - 2017-03-30 19:20 +0200

#1613307 — Re: [PATCH 4/4] mm/vmalloc: remove vfree_atomic()

FromMatthew Wilcox <willy@infradead.org>
Date2017-03-30 19:20 +0200
SubjectRe: [PATCH 4/4] mm/vmalloc: remove vfree_atomic()
Message-ID<tqLTQ-1a6-23@gated-at.bofh.it>
On Thu, Mar 30, 2017 at 01:27:19PM +0300, Andrey Ryabinin wrote:
> vfree() can be used in any atomic context and there is no
> vfree_atomic() callers left, so let's remove it.

We might still get warnings though.

> @@ -1588,9 +1556,11 @@ void vfree(const void *addr)
>  
>  	if (!addr)
>  		return;
> -	if (unlikely(in_interrupt()))
> -		__vfree_deferred(addr);
> -	else
> +	if (unlikely(in_interrupt())) {
> +		struct vfree_deferred *p = this_cpu_ptr(&vfree_deferred);
> +		if (llist_add((struct llist_node *)addr, &p->list))
> +			schedule_work(&p->wq);
> +	} else
>  		__vunmap(addr, 1);
>  }
>  EXPORT_SYMBOL(vfree);

If I disable preemption, then call vfree(), in_interrupt() will not be
true (I've only incremented preempt_count()), then __vunmap() calls
remove_vm_area() which calls might_sleep(), which will warn.

So I think this check needs to change from in_interrupt() to in_atomic().

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web