From: George Spelvin <lkml@SDF.ORG>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: rcu@vger.kernel.org, josh@joshtriplett.org, rostedt@goodmis.org,
mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
joel@joelfernandes.org, urezki@gmail.com, lkml@sdf.org
Subject: Re: Is there a reason we don't have kvfree_rcu()?
Date: Thu, 12 Mar 2020 22:24:44 +0000 [thread overview]
Message-ID: <20200312222444.GA20080@SDF.ORG> (raw)
In-Reply-To: <20200312181138.GI3199@paulmck-ThinkPad-P72>
> There was a recent proposal to do just that, but current patches in -rcu
> use kfree_bulk(). It doesn't look to me that this works for kfvree()
> under the covers in its current form. Could it be upgraded to handle
> this case?
It would take a bit more fiddling, but nothing too difficult.
// from include/linux/mm.h
static inline bool is_vmalloc_addr(const void *x)
{
unsigned long addr = (unsigned long)x;
return addr >= VMALLOC_START && addr < VMALLOC_END;
}
// ... which could also be written as (addr - VMALLOC_START) < VMALLOC_TOTAL
// from mm/util.c
void kvfree(const void *addr)
{
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
... so you could easily do the filtering yourself while forming the
kfree_bulk array.
vfree(p) itself is a wrapper around __vunmap(p, 1). After some
error-checking, it checks if it's called in interrupt context,
If not, it does the __vunmap synchronously. If it *is* in interrupt
context, the freed object is put on a linked list and a work queue
does the __vunmap later.
prev parent reply other threads:[~2020-03-12 22:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-12 16:27 Is there a reason we don't have kvfree_rcu()? George Spelvin
2020-03-12 18:11 ` Paul E. McKenney
2020-03-12 19:10 ` Uladzislau Rezki
2020-03-13 3:58 ` Joel Fernandes
2020-03-13 13:21 ` Uladzislau Rezki
2020-03-13 13:40 ` Joel Fernandes
2020-03-13 5:06 ` George Spelvin
2020-03-13 13:44 ` Uladzislau Rezki
2020-03-13 13:54 ` Paul E. McKenney
2020-03-13 16:52 ` George Spelvin
2020-03-13 18:19 ` Paul E. McKenney
2020-03-13 18:46 ` George Spelvin
2020-03-13 19:58 ` Paul E. McKenney
2020-03-12 22:24 ` George Spelvin [this message]
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=20200312222444.GA20080@SDF.ORG \
--to=lkml@sdf.org \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=urezki@gmail.com \
/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).