提交 0dd4da5b 编写于 作者: M Matthew Wilcox 提交者: Linus Torvalds

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/20171220155552.15884-6-willy@infradead.orgSigned-off-by: NMatthew Wilcox <mawilcox@microsoft.com>
Acked-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: NMichal Hocko <mhocko@suse.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 b26435a0
...@@ -41,9 +41,15 @@ struct hmm; ...@@ -41,9 +41,15 @@ struct hmm;
*/ */
#ifdef CONFIG_HAVE_ALIGNED_STRUCT_PAGE #ifdef CONFIG_HAVE_ALIGNED_STRUCT_PAGE
#define _struct_page_alignment __aligned(2 * sizeof(unsigned long)) #define _struct_page_alignment __aligned(2 * sizeof(unsigned long))
#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE)
#define _slub_counter_t unsigned long
#else #else
#define _struct_page_alignment #define _slub_counter_t unsigned int
#endif #endif
#else /* !CONFIG_HAVE_ALIGNED_STRUCT_PAGE */
#define _struct_page_alignment
#define _slub_counter_t unsigned int
#endif /* !CONFIG_HAVE_ALIGNED_STRUCT_PAGE */
struct page { struct page {
/* First double word block */ /* First double word block */
...@@ -66,18 +72,7 @@ struct page { ...@@ -66,18 +72,7 @@ struct page {
}; };
union { union {
#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE) && \ _slub_counter_t counters;
defined(CONFIG_HAVE_ALIGNED_STRUCT_PAGE)
/* Used for cmpxchg_double in slub */
unsigned long counters;
#else
/*
* Keep _refcount separate from slub cmpxchg_double data.
* As the rest of the double word is protected by slab_lock
* but _refcount is not.
*/
unsigned counters;
#endif
unsigned int active; /* SLAB */ unsigned int active; /* SLAB */
struct { /* SLUB */ struct { /* SLUB */
unsigned inuse:16; unsigned inuse:16;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册