RE: [PATCH 9/9] x86/lib/memset_64.S: Optimize memset by enhancedREP MOVSB/STOSB

From: Yu, Fenghua
Date: Wed May 18 2011 - 14:51:23 EST


> -----Original Message-----
> From: Andi Kleen [mailto:andi@xxxxxxxxxxxxxx]
> Sent: Wednesday, May 18, 2011 11:39 AM
> To: Yu, Fenghua
> Cc: Andi Kleen; Ingo Molnar; Thomas Gleixner; H Peter Anvin; Mallick,
> Asit K; Linus Torvalds; Avi Kivity; Arjan van de Ven; Andrew Morton;
> linux-kernel
> Subject: Re: [PATCH 9/9] x86/lib/memset_64.S: Optimize memset by
> enhanced REP MOVSB/STOSB
>
> > I use gcc 4.3.2 installed by FC10 to build kernel with defconfig.
> Only memcpy is built with gcc builtin and inline memcpy. All of others
> (i.e. memset, clear_page, memmove, and copy_user) call the kernel lib.
> >
> > It's easy to check this by disassembling kernel binary.
>
> gcc has a complex set of heuristics. For example if it cannot decide
> the length or the alignment it calls the kernel code. Otherwise
> it inlines.
>
> So just looking at a few examples won't give you the whole picture.

What gcc 4.3.2 handles memcpy in kernel is to put inline code in kernel. Gcc 4.3.2 doesn't generate code to call kernel memcpy. Other version may do this. But not 4.3.2.

Thanks.

-Fenghua
--
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/