[PATCH] um: allow using glibc string functions instead of generics

Anton Ivanov anton.ivanov at cambridgegreys.com
Wed Nov 11 03:26:24 EST 2020



On 11/11/2020 07:13, Anton Ivanov wrote:
> On 10/11/2020 21:39, Richard Weinberger wrote:
>> ----- Ursprüngliche Mail -----
>>> Von: "anton ivanov" <anton.ivanov at cambridgegreys.com>
>>> An: "richard" <richard at nod.at>
>>> CC: "linux-um" <linux-um at lists.infradead.org>
>>> Gesendet: Dienstag, 10. November 2020 22:33:48
>>> Betreff: Re: [PATCH] um: allow using glibc string functions instead of generics
>>
>>> On 10/11/2020 21:29, Richard Weinberger wrote:
>>>> ----- Ursprüngliche Mail -----
>>>>> Von: "anton ivanov" <anton.ivanov at cambridgegreys.com>
>>>>>> On what workload did you see such a huge performance improvement?
>>>>> File IO ~ 1% or thereabouts, iperf - 2-4%.
>>>>>
>>>>>> The in-kernel variants of memcpy and such are already well optimized.
>>>>> UML has no string.h in asm which means it falls back to
>>>>> asm-generic/string.h which in turn pulls in the ones from lib/string.c
>>>>>
>>>>> These are not optimized.
>>>> Hmmm, I think it should use the highly optimized variants from arch/x86.
>>>
>>> That is the other option - to bring in string32.h and string64.h from x86.
>>
>> Yes, I thought we do so already. I fear we list this feature after some code
>> cleanup a long time ago.
>>
>> I'm happy with either option.
> 
> I will have a look if we lost other optimized code as a result of the asm cleanup and sort it out in the next version.

Out of the important bits we have lost the x86 optimized code for:

1. memcpy and other strings.h functions
2. cksum
3. xor

while memcpy and friends can be picked up from glibc the others can't. So we might as well figure out how to pick them up from the x86 tree.

> 
> The advantage of glibc is that it is guaranteed to chose the correct flavor for the CPU.
> 
> I do not think that this the case for the kernel ones, because they rely on boottime CPU features detection which does not happen in the case of UML. So in order to use them properly, we may have to implement that.
> 
> Otherwise, the code in the glibc tree and in the kernel is nearly identical. Just glibc was easier as it did not require figuring out CPU detection :)
> 
>>
>> Thanks,
>> //richard
>>
>> _______________________________________________
>> linux-um mailing list
>> linux-um at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-um
>>
> 
> 

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/



More information about the linux-um mailing list