From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
<penguin-kernel@I-love.SAKURA.ne.jp>, <mhocko@kernel.org>,
<linux-mm@kvack.org>, <hpa@zytor.com>, <chris@chris-wilson.co.uk>,
<hch@lst.de>, <mingo@elte.hu>, <jszhang@marvell.com>,
<joelaf@google.com>, <joaodias@google.com>, <willy@infradead.org>,
<tglx@linutronix.de>, <thellstrom@vmware.com>
Subject: [PATCH v2 4/5] mm/vmalloc: remove vfree_atomic()
Date: Wed, 12 Apr 2017 15:49:04 +0300 [thread overview]
Message-ID: <20170412124905.25443-5-aryabinin@virtuozzo.com> (raw)
In-Reply-To: <20170412124905.25443-1-aryabinin@virtuozzo.com>
vfree() can be used in any atomic context and there is no
vfree_atomic() callers left, so let's remove it.
This reverts commit bf22e37a6413 ("mm: add vfree_atomic()")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Acked-by: Michal Hocko <mhocko@suse.com>
---
include/linux/vmalloc.h | 1 -
mm/vmalloc.c | 40 +++++-----------------------------------
2 files changed, 5 insertions(+), 36 deletions(-)
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 46991ad..b4f044f 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -83,7 +83,6 @@ extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
extern void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags);
extern void vfree(const void *addr);
-extern void vfree_atomic(const void *addr);
extern void *vmap(struct page **pages, unsigned int count,
unsigned long flags, pgprot_t prot);
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1c74b26..ee62c0a 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1534,38 +1534,6 @@ static void __vunmap(const void *addr, int deallocate_pages)
return;
}
-static inline void __vfree_deferred(const void *addr)
-{
- /*
- * Use raw_cpu_ptr() because this can be called from preemptible
- * context. Preemption is absolutely fine here, because the llist_add()
- * implementation is lockless, so it works even if we are adding to
- * nother cpu's list. schedule_work() should be fine with this too.
- */
- struct vfree_deferred *p = raw_cpu_ptr(&vfree_deferred);
-
- if (llist_add((struct llist_node *)addr, &p->list))
- schedule_work(&p->wq);
-}
-
-/**
- * vfree_atomic - release memory allocated by vmalloc()
- * @addr: memory base address
- *
- * This one is just like vfree() but can be called in any atomic context
- * except NMIs.
- */
-void vfree_atomic(const void *addr)
-{
- BUG_ON(in_nmi());
-
- kmemleak_free(addr);
-
- if (!addr)
- return;
- __vfree_deferred(addr);
-}
-
/**
* vfree - release memory allocated by vmalloc()
* @addr: memory base address
@@ -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);
--
2.10.2
next prev parent reply other threads:[~2017-04-12 12:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 10:27 [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context Andrey Ryabinin
2017-03-30 10:27 ` [PATCH 2/4] x86/ldt: use vfree() instead of vfree_atomic() Andrey Ryabinin
2017-03-31 8:05 ` Thomas Gleixner
2017-03-30 10:27 ` [PATCH 3/4] kernel/fork: use vfree() instead of vfree_atomic() to free thread stack Andrey Ryabinin
2017-03-30 10:27 ` [PATCH 4/4] mm/vmalloc: remove vfree_atomic() Andrey Ryabinin
2017-03-30 17:18 ` Matthew Wilcox
2017-03-30 15:27 ` Andrey Ryabinin
2017-04-04 9:40 ` Michal Hocko
2017-03-30 12:00 ` [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context Thomas Hellstrom
2017-03-30 14:48 ` Andrey Ryabinin
2017-03-30 15:04 ` Thomas Hellstrom
2017-04-04 9:41 ` Michal Hocko
2017-04-04 9:49 ` Thomas Hellstrom
2017-04-05 10:31 ` Andrey Ryabinin
2017-04-05 10:42 ` Michal Hocko
2017-04-05 11:42 ` Vlastimil Babka
2017-04-05 12:14 ` Michal Hocko
2017-03-30 22:22 ` Andrew Morton
2017-03-31 7:12 ` Joel Fernandes
2017-03-31 9:26 ` Andrey Ryabinin
2017-04-04 9:36 ` Michal Hocko
2017-04-04 9:38 ` Michal Hocko
2017-04-12 12:49 ` [PATCH v2 0/5] " Andrey Ryabinin
2017-04-12 12:49 ` [PATCH v2 1/5] mm/vmalloc: " Andrey Ryabinin
2017-04-12 12:49 ` [PATCH v2 2/5] x86/ldt: use vfree() instead of vfree_atomic() Andrey Ryabinin
2017-04-12 12:49 ` [PATCH v2 3/5] kernel/fork: use vfree() instead of vfree_atomic() to free thread stack Andrey Ryabinin
2017-04-12 12:49 ` Andrey Ryabinin [this message]
2017-04-12 12:49 ` [PATCH v2 5/5] mm/vmalloc: Don't spawn workers if somebody already purging Andrey Ryabinin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170412124905.25443-5-aryabinin@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=chris@chris-wilson.co.uk \
--cc=hch@lst.de \
--cc=hpa@zytor.com \
--cc=joaodias@google.com \
--cc=joelaf@google.com \
--cc=jszhang@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mingo@elte.hu \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=tglx@linutronix.de \
--cc=thellstrom@vmware.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).