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

Anton Ivanov anton.ivanov at cambridgegreys.com
Tue Nov 10 15:56:24 EST 2020


On 10/11/2020 20:13, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
>> Von: "anton ivanov" <anton.ivanov at cambridgegreys.com>
>> An: "linux-um" <linux-um at lists.infradead.org>
>> CC: "richard" <richard at nod.at>, "anton ivanov" <anton.ivanov at cambridgegreys.com>
>> Gesendet: Dienstag, 10. November 2020 17:30:34
>> Betreff: [PATCH] um: allow using glibc string functions instead of generics
> 
>> From: Anton Ivanov <anton.ivanov at cambridgegreys.com>
>>
>> UML kernel runs as a normal userspace process and can use the
>> optimized glibc strings functions like strcpy, memcpy, etc.
>>
>> The support is optional and is turned on/of using a config
>> option.
>>
>> Using glibc functions results in a slightly smaller executable
>> when linked dynamically as well as anything between 1% and 5%
>> performance improvements.
> 
> 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.

Example - memcpy:

void *memcpy(void *dest, const void *src, size_t count)
{
	char *tmp = dest;
	const char *s = src;

	while (count--)
		*tmp++ = *s++;
	return dest;
}


> So I'm a little surprised.

I am actually surprised the gain is so low. I was expecting up to 15%.

> 
> Thanks,
> //richard
> 


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



More information about the linux-um mailing list