Re: [MM PATCH V4 5/6] slub: support for bulk free with SLUB freelists

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

 



On 09/29/2015 10:00 AM, Jesper Dangaard Brouer wrote:
On Tue, 29 Sep 2015 09:38:30 -0700
Alexander Duyck <alexander.duyck@xxxxxxxxx> wrote:

On 09/29/2015 08:48 AM, Jesper Dangaard Brouer wrote:
+#if defined(CONFIG_KMEMCHECK) ||		\
+	defined(CONFIG_LOCKDEP)	||		\
+	defined(CONFIG_DEBUG_KMEMLEAK) ||	\
+	defined(CONFIG_DEBUG_OBJECTS_FREE) ||	\
+	defined(CONFIG_KASAN)
+static inline void slab_free_freelist_hook(struct kmem_cache *s,
+					   void *head, void *tail)
+{
+	void *object = head;
+	void *tail_obj = tail ? : head;
+
+	do {
+		slab_free_hook(s, object);
+	} while ((object != tail_obj) &&
+		 (object = get_freepointer(s, object)));
+}
+#else
+static inline void slab_free_freelist_hook(struct kmem_cache *s, void *obj_tail,
+					   void *freelist_head) {}
+#endif
+
Instead of messing around with an #else you might just wrap the contents
of slab_free_freelist_hook in the #if/#endif instead of the entire
function declaration.
I had it that way in an earlier version of the patch, but I liked
better this way.

It would be nice if the argument names were the same for both cases. Having the names differ will make it more difficult to maintain when changes need to be made to the function.

- Alex

--
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]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]