linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: linux-next: Tree for May 13 (mm/page_alloc.c, <linux/mm.h>: sizeof(struct page))
       [not found] <20210513154418.2946f422@canb.auug.org.au>
@ 2021-05-13 17:29 ` Randy Dunlap
  2021-05-13 21:27   ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2021-05-13 17:29 UTC (permalink / raw)
  To: Stephen Rothwell, Linux Next Mailing List
  Cc: Linux Kernel Mailing List, Alexander Duyck, Andrew Morton, Linux MM

[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]

On 5/12/21 10:44 PM, Stephen Rothwell wrote:
> Hi all,
> 
> Changes since 20210512:
> 

on x86_64:

In function ‘__mm_zero_struct_page.isra.75’,
    inlined from ‘__init_single_page.isra.76’ at ../mm/page_alloc.c:1494:2:
./../include/linux/compiler_types.h:328:38: error: call to ‘__compiletime_assert_162’ declared with attribute error: BUILD_BUG_ON failed: sizeof(struct page) > 80
  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
                                      ^
./../include/linux/compiler_types.h:309:4: note: in definition of macro ‘__compiletime_assert’
    prefix ## suffix();    \
    ^~~~~~
./../include/linux/compiler_types.h:328:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
  ^~~~~~~~~~~~~~~~~~~
../include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^~~~~~~~~~~~~~~~~~
../include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
  ^~~~~~~~~~~~~~~~
../include/linux/mm.h:169:2: note: in expansion of macro ‘BUILD_BUG_ON’
  BUILD_BUG_ON(sizeof(struct page) > 80);
  ^~~~~~~~~~~~


Full randconfig file is attached.

$ gcc --version
gcc (SUSE Linux) 7.5.0


-- 
~Randy
Reported-by: Randy Dunlap <rdunlap@infradead.org>


[-- Attachment #2: config-r9309.gz --]
[-- Type: application/gzip, Size: 25479 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: Tree for May 13 (mm/page_alloc.c, <linux/mm.h>: sizeof(struct page))
  2021-05-13 17:29 ` linux-next: Tree for May 13 (mm/page_alloc.c, <linux/mm.h>: sizeof(struct page)) Randy Dunlap
@ 2021-05-13 21:27   ` Matthew Wilcox
  2021-05-18  4:03     ` Anshuman Khandual
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2021-05-13 21:27 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Stephen Rothwell, Linux Next Mailing List,
	Linux Kernel Mailing List, Alexander Duyck, Andrew Morton,
	Linux MM, Anshuman Khandual

On Thu, May 13, 2021 at 10:29:49AM -0700, Randy Dunlap wrote:
> On 5/12/21 10:44 PM, Stephen Rothwell wrote:
> > Hi all,
> > 
> > Changes since 20210512:
> > 
> 
> on x86_64:
> 
> In function ‘__mm_zero_struct_page.isra.75’,
>     inlined from ‘__init_single_page.isra.76’ at ../mm/page_alloc.c:1494:2:
> ./../include/linux/compiler_types.h:328:38: error: call to ‘__compiletime_assert_162’ declared with attribute error: BUILD_BUG_ON failed: sizeof(struct page) > 80

Hmm.

                struct {
                        long unsigned int _pt_pad_1;     /*     8     8 */
                        pgtable_t  pmd_huge_pte;         /*    16     8 */
                        long unsigned int _pt_pad_2;     /*    24     8 */
                        union {
                                struct mm_struct * pt_mm; /*    32     8 */
                                atomic_t pt_frag_refcount; /*    32     4 */
                        };                               /*    32     8 */
                        spinlock_t ptl;                  /*    40    72 */
                };                                       /*     8   104 */

#if ALLOC_SPLIT_PTLOCKS
                        spinlock_t *ptl;
#else
                        spinlock_t ptl;
#endif

something has disabled ALLOC_SPLIT_PTLOCKS when it ought to be enabled.

#if USE_SPLIT_PTE_PTLOCKS
#define ALLOC_SPLIT_PTLOCKS     (SPINLOCK_SIZE > BITS_PER_LONG/8)
#else
#define ALLOC_SPLIT_PTLOCKS     0
#endif

Oh.  This is Anshuman's fault.

commit 9b8a39056e2472592a5e5897987387f43038b8ba
Author: Anshuman Khandual <anshuman.khandual@arm.com>
Date:   Tue May 11 15:06:01 2021 +1000

    mm/thp: make ALLOC_SPLIT_PTLOCKS dependent on USE_SPLIT_PTE_PTLOCKS




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: Tree for May 13 (mm/page_alloc.c, <linux/mm.h>: sizeof(struct page))
  2021-05-13 21:27   ` Matthew Wilcox
@ 2021-05-18  4:03     ` Anshuman Khandual
  2021-05-18  4:59       ` Randy Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2021-05-18  4:03 UTC (permalink / raw)
  To: Matthew Wilcox, Randy Dunlap
  Cc: Stephen Rothwell, Linux Next Mailing List,
	Linux Kernel Mailing List, Alexander Duyck, Andrew Morton,
	Linux MM



On 5/14/21 2:57 AM, Matthew Wilcox wrote:
> On Thu, May 13, 2021 at 10:29:49AM -0700, Randy Dunlap wrote:
>> On 5/12/21 10:44 PM, Stephen Rothwell wrote:
>>> Hi all,
>>>
>>> Changes since 20210512:
>>>
>>
>> on x86_64:
>>
>> In function ‘__mm_zero_struct_page.isra.75’,
>>     inlined from ‘__init_single_page.isra.76’ at ../mm/page_alloc.c:1494:2:
>> ./../include/linux/compiler_types.h:328:38: error: call to ‘__compiletime_assert_162’ declared with attribute error: BUILD_BUG_ON failed: sizeof(struct page) > 80
> 
> Hmm.
> 
>                 struct {
>                         long unsigned int _pt_pad_1;     /*     8     8 */
>                         pgtable_t  pmd_huge_pte;         /*    16     8 */
>                         long unsigned int _pt_pad_2;     /*    24     8 */
>                         union {
>                                 struct mm_struct * pt_mm; /*    32     8 */
>                                 atomic_t pt_frag_refcount; /*    32     4 */
>                         };                               /*    32     8 */
>                         spinlock_t ptl;                  /*    40    72 */
>                 };                                       /*     8   104 */
> 
> #if ALLOC_SPLIT_PTLOCKS
>                         spinlock_t *ptl;
> #else
>                         spinlock_t ptl;
> #endif
> 
> something has disabled ALLOC_SPLIT_PTLOCKS when it ought to be enabled.
> 
> #if USE_SPLIT_PTE_PTLOCKS
> #define ALLOC_SPLIT_PTLOCKS     (SPINLOCK_SIZE > BITS_PER_LONG/8)
> #else
> #define ALLOC_SPLIT_PTLOCKS     0
> #endif
> 
> Oh.  This is Anshuman's fault.
> 
> commit 9b8a39056e2472592a5e5897987387f43038b8ba
> Author: Anshuman Khandual <anshuman.khandual@arm.com>
> Date:   Tue May 11 15:06:01 2021 +1000
> 
>     mm/thp: make ALLOC_SPLIT_PTLOCKS dependent on USE_SPLIT_PTE_PTLOCKS
> 
> 

Previously ALLOC_SPLIT_PTLOCKS was evaluated and the spin lock element
in struct page was getting created independent of whether split pte
locks are being used or not. AFAICS without USE_SPLIT_PTE_PTLOCKS, it
does not really matter whether struct page has spinlock_t *ptl or ptl
element because that is not going to be used. Should the BUILD_BUG_ON()
evaluation be changed when USE_SPLIT_PTE_PTLOCKS is not enabled or we
could something like this which drops the ptl element in such cases ?

--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -152,11 +152,13 @@ struct page {
                                struct mm_struct *pt_mm; /* x86 pgds only */
                                atomic_t pt_frag_refcount; /* powerpc */
                        };
+#if USE_SPLIT_PTE_PTLOCKS
 #if ALLOC_SPLIT_PTLOCKS
                        spinlock_t *ptl;
 #else
                        spinlock_t ptl;
 #endif
+#endif
                };
                struct {        /* ZONE_DEVICE pages */
                        /** @pgmap: Points to the hosting device page map. */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: Tree for May 13 (mm/page_alloc.c, <linux/mm.h>: sizeof(struct page))
  2021-05-18  4:03     ` Anshuman Khandual
@ 2021-05-18  4:59       ` Randy Dunlap
  0 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2021-05-18  4:59 UTC (permalink / raw)
  To: Anshuman Khandual, Matthew Wilcox
  Cc: Stephen Rothwell, Linux Next Mailing List,
	Linux Kernel Mailing List, Alexander Duyck, Andrew Morton,
	Linux MM

On 5/17/21 9:03 PM, Anshuman Khandual wrote:
> 
> 
> On 5/14/21 2:57 AM, Matthew Wilcox wrote:
>> On Thu, May 13, 2021 at 10:29:49AM -0700, Randy Dunlap wrote:
>>> On 5/12/21 10:44 PM, Stephen Rothwell wrote:
>>>> Hi all,
>>>>
>>>> Changes since 20210512:
>>>>
>>>
>>> on x86_64:
>>>
>>> In function ‘__mm_zero_struct_page.isra.75’,
>>>     inlined from ‘__init_single_page.isra.76’ at ../mm/page_alloc.c:1494:2:
>>> ./../include/linux/compiler_types.h:328:38: error: call to ‘__compiletime_assert_162’ declared with attribute error: BUILD_BUG_ON failed: sizeof(struct page) > 80
>>
>> Hmm.
>>
>>                 struct {
>>                         long unsigned int _pt_pad_1;     /*     8     8 */
>>                         pgtable_t  pmd_huge_pte;         /*    16     8 */
>>                         long unsigned int _pt_pad_2;     /*    24     8 */
>>                         union {
>>                                 struct mm_struct * pt_mm; /*    32     8 */
>>                                 atomic_t pt_frag_refcount; /*    32     4 */
>>                         };                               /*    32     8 */
>>                         spinlock_t ptl;                  /*    40    72 */
>>                 };                                       /*     8   104 */
>>
>> #if ALLOC_SPLIT_PTLOCKS
>>                         spinlock_t *ptl;
>> #else
>>                         spinlock_t ptl;
>> #endif
>>
>> something has disabled ALLOC_SPLIT_PTLOCKS when it ought to be enabled.
>>
>> #if USE_SPLIT_PTE_PTLOCKS
>> #define ALLOC_SPLIT_PTLOCKS     (SPINLOCK_SIZE > BITS_PER_LONG/8)
>> #else
>> #define ALLOC_SPLIT_PTLOCKS     0
>> #endif
>>
>> Oh.  This is Anshuman's fault.
>>
>> commit 9b8a39056e2472592a5e5897987387f43038b8ba
>> Author: Anshuman Khandual <anshuman.khandual@arm.com>
>> Date:   Tue May 11 15:06:01 2021 +1000
>>
>>     mm/thp: make ALLOC_SPLIT_PTLOCKS dependent on USE_SPLIT_PTE_PTLOCKS
>>
>>
> 
> Previously ALLOC_SPLIT_PTLOCKS was evaluated and the spin lock element
> in struct page was getting created independent of whether split pte
> locks are being used or not. AFAICS without USE_SPLIT_PTE_PTLOCKS, it
> does not really matter whether struct page has spinlock_t *ptl or ptl
> element because that is not going to be used. Should the BUILD_BUG_ON()
> evaluation be changed when USE_SPLIT_PTE_PTLOCKS is not enabled or we
> could something like this which drops the ptl element in such cases ?
> 
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -152,11 +152,13 @@ struct page {
>                                 struct mm_struct *pt_mm; /* x86 pgds only */
>                                 atomic_t pt_frag_refcount; /* powerpc */
>                         };
> +#if USE_SPLIT_PTE_PTLOCKS
>  #if ALLOC_SPLIT_PTLOCKS
>                         spinlock_t *ptl;
>  #else
>                         spinlock_t ptl;
>  #endif
> +#endif
>                 };
>                 struct {        /* ZONE_DEVICE pages */
>                         /** @pgmap: Points to the hosting device page map. */
> 

OK, that works.  Thanks.

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested


I guess you should send a proper patch to Andrew.  The code above
is whitespace-damaged (cut'n'paste).

-- 
~Randy



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-18  5:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210513154418.2946f422@canb.auug.org.au>
2021-05-13 17:29 ` linux-next: Tree for May 13 (mm/page_alloc.c, <linux/mm.h>: sizeof(struct page)) Randy Dunlap
2021-05-13 21:27   ` Matthew Wilcox
2021-05-18  4:03     ` Anshuman Khandual
2021-05-18  4:59       ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).