Skip to content

Commit 0dd4da5

Browse files
Matthew Wilcoxtorvalds
authored andcommitted
mm: introduce _slub_counter_t
Instead of putting the ifdef in the middle of the definition of struct page, pull it forward to the rest of the ifdeffery around the SLUB cmpxchg_double optimisation. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox <[email protected]> Acked-by: Kirill A. Shutemov <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent b26435a commit 0dd4da5

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

include/linux/mm_types.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ struct hmm;
4141
*/
4242
#ifdef CONFIG_HAVE_ALIGNED_STRUCT_PAGE
4343
#define _struct_page_alignment __aligned(2 * sizeof(unsigned long))
44+
#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE)
45+
#define _slub_counter_t unsigned long
4446
#else
45-
#define _struct_page_alignment
47+
#define _slub_counter_t unsigned int
4648
#endif
49+
#else /* !CONFIG_HAVE_ALIGNED_STRUCT_PAGE */
50+
#define _struct_page_alignment
51+
#define _slub_counter_t unsigned int
52+
#endif /* !CONFIG_HAVE_ALIGNED_STRUCT_PAGE */
4753

4854
struct page {
4955
/* First double word block */
@@ -66,18 +72,7 @@ struct page {
6672
};
6773

6874
union {
69-
#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE) && \
70-
defined(CONFIG_HAVE_ALIGNED_STRUCT_PAGE)
71-
/* Used for cmpxchg_double in slub */
72-
unsigned long counters;
73-
#else
74-
/*
75-
* Keep _refcount separate from slub cmpxchg_double data.
76-
* As the rest of the double word is protected by slab_lock
77-
* but _refcount is not.
78-
*/
79-
unsigned counters;
80-
#endif
75+
_slub_counter_t counters;
8176
unsigned int active; /* SLAB */
8277
struct { /* SLUB */
8378
unsigned inuse:16;

0 commit comments

Comments
 (0)