Re: [PATCH 00/12] IO-less dirty throttling v7

From: Sedat Dilek
Date: Mon Apr 18 2011 - 06:22:44 EST


On Mon, Apr 18, 2011 at 10:18 AM, Wu Fengguang <fengguang.wu@xxxxxxxxx> wrote:
>> Unfortunately, this "v2" patch still breaks with gcc-4.6 here:
>>
>> Â LD Â Â Â.tmp_vmlinux1
>> mm/built-in.o: In function `calc_period_shift.part.10':
>> page-writeback.c:(.text+0x6458): undefined reference to `____ilog2_NaN'
>> make[4]: *** [.tmp_vmlinux1] Error 1
>>
>> My patchset against next-20110415 looks like this:
>>
>> Â (+) OK Â writeback-dirty-throttling-v7/writeback-dirty-throttling-v7.patch
>> Â (+) OK Â writeback-dirty-throttling-post-v7/0001-writeback-i386-compile-fix.patch
>> Â (+) OK Â writeback-dirty-throttling-post-v7/0002-writeback-quick-CONFIG_BLK_DEV_THROTTLING-n-compile-.patch
>> Â (+) OK Â writeback-dirty-throttling-post-v7/0003-Revert-writeback-scale-dirty-proportions-period-with.patch
>> Â (+) OK Â writeback-dirty-throttling-v7-fix/writeback-scale-dirty-proportions-period-with-writeout-bandwidth-v2.patch
>>
>> Attached are the disasm of mm/page-writeback.o (v2, gcc-4.6) and the
>> disasm of yesterday's experiments with gcc-4.5.
>>
>> [ gcc-4.5 ]
>>
>> 00006574 <calc_period_shift>:
>>   6574:    a1 90 00 00 00     Âmov  Â0x90,%eax    Â6575:
>> R_386_32 Âdefault_backing_dev_info
>>   6579:    55           Âpush  %ebp
>>   657a:    89 e5          mov  Â%esp,%ebp
>>   657c:    e8 02 f8 ff ff     Âcall  5d83 <__ilog2_u32>
>>   6581:    5d           Âpop  Â%ebp
>>   6582:    83 c0 02        Âadd  Â$0x2,%eax
>> Â Â 6585: Â Â Â c3 Â Â Â Â Â Â Â Â Â Â Âret
>
> gcc-4.5 is generating the right code, while the below silly macro
> expansion seems like __builtin_constant_p(n) wrongly evaluating to true.
> I wonder if the attached patch will workaround the gcc's bug. It adds a
> local variable in calc_period_shift() for passing to ilog2().
>
> Thanks,
> Fengguang
>

Thanks for the patch, that "gcc-4.6 workaround" works here.
Feel free to add:

Tested-by: Sedat Dilek <sedat.dilek@xxxxxxxxx>.

- Sedat -

P.S.: Attached disasm v3 with gcc-4.6

>> [ gcc-4.6 ]
>>
>> 000008c9 <calc_period_shift.part.10>:
>>   Â8c9:    8b 15 90 00 00 00    mov  Â0x90,%edx    Â8cb:
>> R_386_32 Â default_backing_dev_info
>>   Â8cf:    55           Âpush  %ebp
>>   Â8d0:    89 e5          mov  Â%esp,%ebp
>>   Â8d2:    85 d2          test  %edx,%edx
>>   Â8d4:    0f 88 46 01 00 00    js   a20
>> <calc_period_shift.part.10+0x157>
>>   Â8da:    f7 c2 00 00 00 40    test  $0x40000000,%edx
>>   Â8e0:    b8 20 00 00 00     Âmov  Â$0x20,%eax
>>   Â8e5:    0f 85 3a 01 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â8eb:    f7 c2 00 00 00 20    test  $0x20000000,%edx
>>   Â8f1:    b0 1f          mov  Â$0x1f,%al
>>   Â8f3:    0f 85 2c 01 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â8f9:    f7 c2 00 00 00 10    test  $0x10000000,%edx
>>   Â8ff:    b0 1e          mov  Â$0x1e,%al
>>   Â901:    0f 85 1e 01 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â907:    f7 c2 00 00 00 08    test  $0x8000000,%edx
>>   Â90d:    b0 1d          mov  Â$0x1d,%al
>>   Â90f:    0f 85 10 01 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â915:    f7 c2 00 00 00 04    test  $0x4000000,%edx
>>   Â91b:    b0 1c          mov  Â$0x1c,%al
>>   Â91d:    0f 85 02 01 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â923:    f7 c2 00 00 00 02    test  $0x2000000,%edx
>>   Â929:    b0 1b          mov  Â$0x1b,%al
>>   Â92b:    0f 85 f4 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â931:    f7 c2 00 00 00 01    test  $0x1000000,%edx
>>   Â937:    b0 1a          mov  Â$0x1a,%al
>>   Â939:    0f 85 e6 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â93f:    f7 c2 00 00 80 00    test  $0x800000,%edx
>>   Â945:    b0 19          mov  Â$0x19,%al
>>   Â947:    0f 85 d8 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â94d:    f7 c2 00 00 40 00    test  $0x400000,%edx
>>   Â953:    b0 18          mov  Â$0x18,%al
>>   Â955:    0f 85 ca 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â95b:    f7 c2 00 00 20 00    test  $0x200000,%edx
>>   Â961:    b0 17          mov  Â$0x17,%al
>>   Â963:    0f 85 bc 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â969:    f7 c2 00 00 10 00    test  $0x100000,%edx
>>   Â96f:    b0 16          mov  Â$0x16,%al
>>   Â971:    0f 85 ae 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â977:    f7 c2 00 00 08 00    test  $0x80000,%edx
>>   Â97d:    b0 15          mov  Â$0x15,%al
>>   Â97f:    0f 85 a0 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â985:    f7 c2 00 00 04 00    test  $0x40000,%edx
>>   Â98b:    b0 14          mov  Â$0x14,%al
>>   Â98d:    0f 85 92 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â993:    f7 c2 00 00 02 00    test  $0x20000,%edx
>>   Â999:    b0 13          mov  Â$0x13,%al
>>   Â99b:    0f 85 84 00 00 00    jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9a1:    f7 c2 00 00 01 00    test  $0x10000,%edx
>>   Â9a7:    b0 12          mov  Â$0x12,%al
>>   Â9a9:    75 7a          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9ab:    f6 c6 80        Âtest  $0x80,%dh
>>   Â9ae:    b0 11          mov  Â$0x11,%al
>>   Â9b0:    75 73          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9b2:    f6 c6 40        Âtest  $0x40,%dh
>>   Â9b5:    b0 10          mov  Â$0x10,%al
>>   Â9b7:    75 6c          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9b9:    f6 c6 20        Âtest  $0x20,%dh
>>   Â9bc:    b0 0f          mov  Â$0xf,%al
>>   Â9be:    75 65          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9c0:    f6 c6 10        Âtest  $0x10,%dh
>>   Â9c3:    b0 0e          mov  Â$0xe,%al
>>   Â9c5:    75 5e          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9c7:    f6 c6 08        Âtest  $0x8,%dh
>>   Â9ca:    b0 0d          mov  Â$0xd,%al
>>   Â9cc:    75 57          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9ce:    f6 c6 04        Âtest  $0x4,%dh
>>   Â9d1:    b0 0c          mov  Â$0xc,%al
>>   Â9d3:    75 50          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9d5:    f6 c6 02        Âtest  $0x2,%dh
>>   Â9d8:    b0 0b          mov  Â$0xb,%al
>>   Â9da:    75 49          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9dc:    f6 c6 01        Âtest  $0x1,%dh
>>   Â9df:    b0 0a          mov  Â$0xa,%al
>>   Â9e1:    75 42          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9e3:    f6 c2 80        Âtest  $0x80,%dl
>>   Â9e6:    b0 09          mov  Â$0x9,%al
>>   Â9e8:    75 3b          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9ea:    f6 c2 40        Âtest  $0x40,%dl
>>   Â9ed:    b0 08          mov  Â$0x8,%al
>>   Â9ef:    75 34          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9f1:    f6 c2 20        Âtest  $0x20,%dl
>>   Â9f4:    b0 07          mov  Â$0x7,%al
>>   Â9f6:    75 2d          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9f8:    f6 c2 10        Âtest  $0x10,%dl
>>   Â9fb:    b0 06          mov  Â$0x6,%al
>>   Â9fd:    75 26          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Â9ff:    f6 c2 08        Âtest  $0x8,%dl
>>   Âa02:    b0 05          mov  Â$0x5,%al
>>   Âa04:    75 1f          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Âa06:    f6 c2 04        Âtest  $0x4,%dl
>>   Âa09:    b0 04          mov  Â$0x4,%al
>>   Âa0b:    75 18          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Âa0d:    f6 c2 02        Âtest  $0x2,%dl
>>   Âa10:    b0 03          mov  Â$0x3,%al
>>   Âa12:    75 11          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Âa14:    80 e2 01        Âand  Â$0x1,%dl
>>   Âa17:    b0 02          mov  Â$0x2,%al
>>   Âa19:    75 0a          jne  Âa25
>> <calc_period_shift.part.10+0x15c>
>>   Âa1b:    e8 fc ff ff ff     Âcall  a1c
>> <calc_period_shift.part.10+0x153> Â Âa1c: R_386_PC32 ____ilog2_NaN
>>   Âa20:    b8 21 00 00 00     Âmov  Â$0x21,%eax
>>   Âa25:    5d           Âpop  Â%ebp
>> Â Â Âa26: Â Â Â c3 Â Â Â Â Â Â Â Â Â Â Âret
>>
>> 00000a27 <calc_period_shift>:
>>   Âa27:    55           Âpush  %ebp
>>   Âa28:    83 ca ff        Âor   $0xffffffff,%edx
>>   Âa2b:    89 e5          mov  Â%esp,%ebp
>>   Âa2d:    0f bd 05 90 00 00 00  Âbsr  Â0x90,%eax    Âa30:
>> R_386_32 Â default_backing_dev_info
>> Â Â Âa34: Â Â Â 0f 44 c2 Â Â Â Â Â Â Â Âcmove Â%edx,%eax
>>   Âa37:    5d           Âpop  Â%ebp
>>   Âa38:    83 c0 02        Âadd  Â$0x2,%eax
>> Â Â Âa3b: Â Â Â c3 Â Â Â Â Â Â Â Â Â Â Âret
>>
>> - EOT -
>>
>> - Sedat -
>
>
>
>

Attachment: mm_page-writeback.o_v3.disasm.xz
Description: Binary data