mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH next/mmotm] slub: partly fix freeze in __slab_free
Date: Tue, 12 Jul 2011 10:55:22 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1107121046000.2530@router.home> (raw)
In-Reply-To: <alpine.DEB.2.00.1107121010060.1672@router.home>

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@linux.com>


---
 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 */

  reply	other threads:[~2011-07-12 15:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 18:58 Hugh Dickins
2011-07-11 19:39 ` Eric Dumazet
2011-07-11 20:46   ` Hugh Dickins
2011-07-12  6:13   ` Pekka Enberg
2011-07-12 15:11     ` Christoph Lameter
2011-07-12 15:55       ` Christoph Lameter [this message]
2011-07-13 11:28         ` Hugh Dickins
2011-07-13 15:47           ` Christoph Lameter
2011-07-13 15:55             ` Christoph Lameter
2011-07-14 16:14               ` Hugh Dickins
2011-07-14 17:26                 ` Christoph Lameter
2011-07-15 19:22                   ` Hugh Dickins

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=alpine.DEB.2.00.1107121046000.2530@router.home \
    --to=cl@linux.com \
    --cc=akpm@linux-foundation.org \
    --cc=eric.dumazet@gmail.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@kernel.org \
    /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

all inboxes | Powered by JetHome®