Re: [PATCH 1/2] Move kfree_call_rcu() to slab_common.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 04, 2018 at 02:18:50PM -0800, Rao Shoaib wrote:
> > > > > +#define kfree_rcu(ptr, rcu_head_name) \
> > > > > +    do { \
> > > > > +        typeof(ptr) __ptr = ptr;    \
> > > > > +        unsigned long __off = offsetof(typeof(*(__ptr)), \
> > > > > +                              rcu_head_name); \
> > > > > +        struct rcu_head *__rptr = (void *)__ptr + __off; \
> > > > > +        __kfree_rcu(__rptr, __off); \
> > > > > +    } while (0)
> > > > why do you want to open code this?
> > But why are you changing this macro at all?  If it was to avoid the
> > double-mention of "ptr", then you haven't done that.
> I have -- I do not get the error because ptr is being assigned only one. If
> you have a better way than let me know and I will be happy to make the
> change.

But look at the original:

#define kfree_rcu(ptr, rcu_head)                                        \
        __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
                       ^^^                                ^^^

versus your version:

+#define kfree_rcu(ptr, rcu_head_name) \
+    do { \
+        typeof(ptr) __ptr = ptr;    \
                ^^^          ^^^
+        unsigned long __off = offsetof(typeof(*(__ptr)), \
+                              rcu_head_name); \
+        struct rcu_head *__rptr = (void *)__ptr + __off; \
+        __kfree_rcu(__rptr, __off); \
+    } while (0)

I don't see the difference.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux