lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3f8e66f4-e725-c871-8d8b-0fcd3da20b36@nitingupta.dev>
Date:   Mon, 15 Jun 2020 07:34:04 -0700
From:   Nitin Gupta <ngupta@...ingupta.dev>
To:     Oleksandr Natalenko <oleksandr@...hat.com>,
        Nitin Gupta <nigupta@...dia.com>
Cc:     Mel Gorman <mgorman@...hsingularity.net>,
        Michal Hocko <mhocko@...e.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Matthew Wilcox <willy@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        David Rientjes <rientjes@...gle.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-mm <linux-mm@...ck.org>,
        Linux API <linux-api@...r.kernel.org>
Subject: Re: [PATCH v6] mm: Proactive compaction

On 6/15/20 7:25 AM, Oleksandr Natalenko wrote:
> On Mon, Jun 15, 2020 at 10:29:01AM +0200, Oleksandr Natalenko wrote:
>> Just to let you know, this fails to compile for me with THP disabled on
>> v5.8-rc1:
>>
>>   CC      mm/compaction.o
>> In file included from ./include/linux/dev_printk.h:14,
>>                  from ./include/linux/device.h:15,
>>                  from ./include/linux/node.h:18,
>>                  from ./include/linux/cpu.h:17,
>>                  from mm/compaction.c:11:
>> In function ‘fragmentation_score_zone’,
>>     inlined from ‘__compact_finished’ at mm/compaction.c:1982:11,
>>     inlined from ‘compact_zone’ at mm/compaction.c:2062:8:
>> ./include/linux/compiler.h:392:38: error: call to ‘__compiletime_assert_397’ declared with attribute error: BUILD_BUG failed
>>   392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>       |                                      ^
>> ./include/linux/compiler.h:373:4: note: in definition of macro ‘__compiletime_assert’
>>   373 |    prefix ## suffix();    \
>>       |    ^~~~~~
>> ./include/linux/compiler.h:392:2: note: in expansion of macro ‘_compiletime_assert’
>>   392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>       |  ^~~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
>>    39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>>       |                                     ^~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
>>    59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
>>       |                     ^~~~~~~~~~~~~~~~
>> ./include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
>>   319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
>>       |                            ^~~~~~~~~
>> ./include/linux/huge_mm.h:115:26: note: in expansion of macro ‘HPAGE_PMD_SHIFT’
>>   115 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
>>       |                          ^~~~~~~~~~~~~~~
>> mm/compaction.c:64:32: note: in expansion of macro ‘HPAGE_PMD_ORDER’
>>    64 | #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER
>>       |                                ^~~~~~~~~~~~~~~
>> mm/compaction.c:1898:28: note: in expansion of macro ‘COMPACTION_HPAGE_ORDER’
>>  1898 |    extfrag_for_order(zone, COMPACTION_HPAGE_ORDER);
>>       |                            ^~~~~~~~~~~~~~~~~~~~~~
>> In function ‘fragmentation_score_zone’,
>>     inlined from ‘kcompactd’ at mm/compaction.c:1918:12:
>> ./include/linux/compiler.h:392:38: error: call to ‘__compiletime_assert_397’ declared with attribute error: BUILD_BUG failed
>>   392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>       |                                      ^
>> ./include/linux/compiler.h:373:4: note: in definition of macro ‘__compiletime_assert’
>>   373 |    prefix ## suffix();    \
>>       |    ^~~~~~
>> ./include/linux/compiler.h:392:2: note: in expansion of macro ‘_compiletime_assert’
>>   392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>       |  ^~~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
>>    39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>>       |                                     ^~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
>>    59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
>>       |                     ^~~~~~~~~~~~~~~~
>> ./include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
>>   319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
>>       |                            ^~~~~~~~~
>> ./include/linux/huge_mm.h:115:26: note: in expansion of macro ‘HPAGE_PMD_SHIFT’
>>   115 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
>>       |                          ^~~~~~~~~~~~~~~
>> mm/compaction.c:64:32: note: in expansion of macro ‘HPAGE_PMD_ORDER’
>>    64 | #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER
>>       |                                ^~~~~~~~~~~~~~~
>> mm/compaction.c:1898:28: note: in expansion of macro ‘COMPACTION_HPAGE_ORDER’
>>  1898 |    extfrag_for_order(zone, COMPACTION_HPAGE_ORDER);
>>       |                            ^~~~~~~~~~~~~~~~~~~~~~
>> In function ‘fragmentation_score_zone’,
>>     inlined from ‘kcompactd’ at mm/compaction.c:1918:12:
>> ./include/linux/compiler.h:392:38: error: call to ‘__compiletime_assert_397’ declared with attribute error: BUILD_BUG failed
>>   392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>       |                                      ^
>> ./include/linux/compiler.h:373:4: note: in definition of macro ‘__compiletime_assert’
>>   373 |    prefix ## suffix();    \
>>       |    ^~~~~~
>> ./include/linux/compiler.h:392:2: note: in expansion of macro ‘_compiletime_assert’
>>   392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>       |  ^~~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
>>    39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>>       |                                     ^~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
>>    59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
>>       |                     ^~~~~~~~~~~~~~~~
>> ./include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
>>   319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
>>       |                            ^~~~~~~~~
>> ./include/linux/huge_mm.h:115:26: note: in expansion of macro ‘HPAGE_PMD_SHIFT’
>>   115 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
>>       |                          ^~~~~~~~~~~~~~~
>> mm/compaction.c:64:32: note: in expansion of macro ‘HPAGE_PMD_ORDER’
>>    64 | #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER
>>       |                                ^~~~~~~~~~~~~~~
>> mm/compaction.c:1898:28: note: in expansion of macro ‘COMPACTION_HPAGE_ORDER’
>>  1898 |    extfrag_for_order(zone, COMPACTION_HPAGE_ORDER);
>>       |                            ^~~~~~~~~~~~~~~~~~~~~~
>> In function ‘fragmentation_score_zone’,
>>     inlined from ‘kcompactd’ at mm/compaction.c:1918:12:
>> ./include/linux/compiler.h:392:38: error: call to ‘__compiletime_assert_397’ declared with attribute error: BUILD_BUG failed
>>   392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>       |                                      ^
>> ./include/linux/compiler.h:373:4: note: in definition of macro ‘__compiletime_assert’
>>   373 |    prefix ## suffix();    \
>>       |    ^~~~~~
>> ./include/linux/compiler.h:392:2: note: in expansion of macro ‘_compiletime_assert’
>>   392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>       |  ^~~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
>>    39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>>       |                                     ^~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
>>    59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
>>       |                     ^~~~~~~~~~~~~~~~
>> ./include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
>>   319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
>>       |                            ^~~~~~~~~
>> ./include/linux/huge_mm.h:115:26: note: in expansion of macro ‘HPAGE_PMD_SHIFT’
>>   115 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
>>       |                          ^~~~~~~~~~~~~~~
>> mm/compaction.c:64:32: note: in expansion of macro ‘HPAGE_PMD_ORDER’
>>    64 | #define COMPACTION_HPAGE_ORDER HPAGE_PMD_ORDER
>>       |                                ^~~~~~~~~~~~~~~
>> mm/compaction.c:1898:28: note: in expansion of macro ‘COMPACTION_HPAGE_ORDER’
>>  1898 |    extfrag_for_order(zone, COMPACTION_HPAGE_ORDER);
>>       |                            ^~~~~~~~~~~~~~~~~~~~~~
>> make[1]: *** [scripts/Makefile.build:281: mm/compaction.o] Error 1
>> make: *** [Makefile:1764: mm] Error 2
>>
> 
> What about doing this:
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 0d4f91dfb801..ac2030814edb 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -60,7 +60,7 @@ static const int HPAGE_FRAG_CHECK_INTERVAL_MSEC = 500;
>   * calculates external fragmentation, which is used as
>   * the "fragmentation score" of a node/zone.
>   */
> -#if defined HPAGE_PMD_ORDER
> +#if defined CONFIG_TRANSPARENT_HUGEPAGE
>  #define COMPACTION_HPAGE_ORDER	HPAGE_PMD_ORDER
>  #elif defined HUGETLB_PAGE_ORDER
>  #define COMPACTION_HPAGE_ORDER	HUGETLB_PAGE_ORDER
> 
> ?
> 

Yes, this looks good. I will send out a v7 patch soon with this change.

Thanks,
Nitin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ