Re: [PATCH next/mmotm] slub: partly fix freeze in __slab_free

From: Christoph Lameter
Date: Tue Jul 12 2011 - 11:55:30 EST


I wish there would be some easier way to overlay fields. The counters
field exists to allow an easier reference to the bitfield structure in
order to pass it to cmpxchg_double_slab.

In 64 bit the counters field needs to overlay the bitfields and _count
since we can only pass 64 bits integers to cmpxchg_double_slab.

On 32 bit counters field only covers the bitfields.

The "new" page struct in __slab_free is only partially populated and the
overlays are used for conversion between structs and words in order to be
able to pass the struct contents by value.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>


---
include/linux/mm_types.h | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)

Index: linux-2.6/include/linux/mm_types.h
===================================================================
--- linux-2.6.orig/include/linux/mm_types.h 2011-07-12 10:14:08.057706223 -0500
+++ linux-2.6/include/linux/mm_types.h 2011-07-12 10:14:14.117706184 -0500
@@ -56,20 +56,26 @@ struct page {
};

union {
- atomic_t _mapcount; /* Count of ptes mapped in mms,
+ /* Used for cmpxchg_double in slub */
+ unsigned long counters;
+
+ struct {
+
+ union {
+ atomic_t _mapcount; /* Count of ptes mapped in mms,
* to show when page is mapped
* & limit reverse map searches.
*/

- /* Used for cmpxchg_double in slub */
- unsigned long counters;
- struct {
- unsigned inuse:16;
- unsigned objects:15;
- unsigned frozen:1;
+ struct {
+ unsigned inuse:16;
+ unsigned objects:15;
+ unsigned frozen:1;
+ };
+ };
+ atomic_t _count; /* Usage count, see below. */
};
};
- atomic_t _count; /* Usage count, see below. */
};

/* Third double word block */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/