From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
Al Viro <viro@zeniv.linux.org.uk>,
Davidlohr Bueso <davidlohr.bueso@hp.com>
Subject: linux-next: manual merge of the akpm tree with the vfs tree
Date: Tue, 30 Apr 2013 15:54:52 +1000 [thread overview]
Message-ID: <20130430155452.f04d1ddf48f402ab50a7002d@canb.auug.org.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 2961 bytes --]
Hi Andrew,
Today's linux-next merge of the akpm tree got a conflict in ipc/util.c
between commit 823a5ed16606 ("ipc_schedule_free() can do vfree() now")
from the vfs tree and commit "ipc: make refcounter atomic" from the akpm
tree.
I fixed it up (I hope - see below) and can carry the fix as necessary (no
action is required).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc ipc/util.c
index 6515f95,5e60ebd..0000000
--- a/ipc/util.c
+++ b/ipc/util.c
@@@ -477,7 -478,8 +477,7 @@@ void ipc_free(void* ptr, int size
*/
struct ipc_rcu_hdr
{
- int refcount;
+ atomic_t refcount;
- int is_vmalloc;
void *data[0];
};
@@@ -497,30 -516,48 +497,28 @@@ struct ipc_rcu_grac
* @size: size desired
*
* Allocate memory for the rcu header structure + the object.
- * Returns the pointer to the object.
- * NULL is returned if the allocation fails.
+ * Returns the pointer to the object or NULL upon failure.
*/
-
- void* ipc_rcu_alloc(int size)
+ void *ipc_rcu_alloc(int size)
{
- void* out;
-
- /*
- * We prepend the allocation with the rcu struct, and
- * workqueue if necessary (for vmalloc).
+ size_t len = size + HDRLEN;
+ void *out;
+ /*
+ * We prepend the allocation with the rcu struct
*/
- if (rcu_use_vmalloc(size)) {
- out = vmalloc(HDRLEN_VMALLOC + size);
- if (!out)
- goto done;
-
- out += HDRLEN_VMALLOC;
- container_of(out, struct ipc_rcu_hdr, data)->is_vmalloc = 1;
- } else {
- out = kmalloc(HDRLEN_KMALLOC + size, GFP_KERNEL);
- if (!out)
- goto done;
-
- out += HDRLEN_KMALLOC;
- container_of(out, struct ipc_rcu_hdr, data)->is_vmalloc = 0;
+ out = (len > PAGE_SIZE) ? vmalloc(len) : kmalloc(len, GFP_KERNEL);
+ if (out) {
+ out += HDRLEN;
- container_of(out, struct ipc_rcu_hdr, data)->refcount = 1;
++ atomic_set(&container_of(out, struct ipc_rcu_hdr, data)->refcount, 1);
}
return out;
}
- void ipc_rcu_getref(void *ptr)
+ int ipc_rcu_getref(void *ptr)
{
- container_of(ptr, struct ipc_rcu_hdr, data)->refcount++;
+ return atomic_inc_not_zero(&container_of(ptr, struct ipc_rcu_hdr, data)->refcount);
}
-static void ipc_do_vfree(struct work_struct *work)
-{
- vfree(container_of(work, struct ipc_rcu_sched, work));
-}
-
/**
* ipc_schedule_free - free ipc + rcu space
* @head: RCU callback structure for queued work
@@@ -534,10 -580,10 +532,10 @@@ static void ipc_schedule_free(struct rc
void ipc_rcu_putref(void *ptr)
{
- if (--container_of(ptr, struct ipc_rcu_hdr, data)->refcount > 0)
+ if (!atomic_dec_and_test(&container_of(ptr, struct ipc_rcu_hdr, data)->refcount))
return;
- if (container_of(ptr, struct ipc_rcu_hdr, data)->is_vmalloc) {
+ if (is_vmalloc_addr(ptr)) {
call_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu,
ipc_schedule_free);
} else {
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next reply other threads:[~2013-04-30 5:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-30 5:54 Stephen Rothwell [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-05-15 11:33 linux-next: manual merge of the akpm tree with the vfs tree Stephen Rothwell
2019-04-11 6:21 Stephen Rothwell
2018-05-17 6:36 Stephen Rothwell
2018-01-02 6:46 Stephen Rothwell
2016-12-12 5:52 Stephen Rothwell
2016-12-12 8:14 ` Ian Kent
2014-08-08 6:20 Stephen Rothwell
2013-09-10 4:41 Stephen Rothwell
2013-09-05 8:56 Stephen Rothwell
2013-04-29 8:34 Stephen Rothwell
2013-04-29 8:25 Stephen Rothwell
2013-04-04 6:26 Stephen Rothwell
2013-04-04 6:56 ` Andrew Morton
2013-04-04 7:02 ` Andrew Morton
2013-04-04 8:10 ` Al Viro
2013-04-04 23:18 ` Stephen Rothwell
2013-04-04 8:02 ` Al Viro
2013-04-04 15:43 ` Nathan Zimmer
2013-04-04 6:17 Stephen Rothwell
2013-04-04 6:12 Stephen Rothwell
2013-04-04 12:33 ` Jan Kara
2013-04-04 6:04 Stephen Rothwell
2013-02-25 3:40 Stephen Rothwell
2012-09-24 13:40 Stephen Rothwell
2012-09-24 13:12 Stephen Rothwell
2012-09-24 13:06 Stephen Rothwell
2012-07-22 5:44 Stephen Rothwell
2011-07-18 8:55 Stephen Rothwell
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=20130430155452.f04d1ddf48f402ab50a7002d@canb.auug.org.au \
--to=sfr@canb.auug.org.au \
--cc=akpm@linux-foundation.org \
--cc=davidlohr.bueso@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).