Re: [PATCH] x86-64: fix memset() to support sizes of 4Gb andabove

From: Jan Beulich
Date: Fri Jan 06 2012 - 07:30:53 EST


>>> On 06.01.12 at 12:05, Ingo Molnar <mingo@xxxxxxx> wrote:

> * Jan Beulich <JBeulich@xxxxxxxx> wrote:
>
>> While currently there doesn't appear to be any reachable
>> in-tree case where such large memory blocks may be passed to
>> memset() (alloc_bootmem() being the primary non-reachable one,
>> as it gets called with suitably large sizes in FLATMEM
>> configurations), we have recently hit the problem a second
>> time in our Xen kernels. Rather than working around it a
>> second time, prevent others from falling into the same trap by
>> fixing this long standing limitation.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> Have you checked the before/after size of the hotpath?
>
> The patch suggests that it got shorter by 3 instructions:
>
>> - movl %edx,%r8d
>> - andl $7,%r8d
>> - movl %edx,%ecx
>> - shrl $3,%ecx
>> + movq %rdx,%rcx
>> + andl $7,%edx
>> + shrq $3,%rcx
>
> [...]
>
>> movq %rdi,%r10
>> - movq %rdx,%r11
>>
>
> [...]
>
>> - movl %r11d,%ecx
>> - andl $7,%ecx
>> + andl $7,%edx
>
> Is that quick impression correct? I have not tried building or
> measuring it.

Yes, that's correct.

As the bodies of the individual flavors didn't change, I see no risk in
this change causing any performance degradation.

> Would be nice to add support for arch/x86/lib/memset_64.S as
> well, and look at the before/after performance of it. In
> userspace we can do a lot more accurate measurements of this
> kind:

I'll see whether I can get this done, but I admit that I'm entirely
unfamiliar with this tool and its infrastructure. I hope doing this is
not going to be a requirement for acceptance of the patch.

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/