[PATCH] um: allow using glibc string functions instead of generics
Johannes Berg
johannes at sipsolutions.net
Tue Nov 10 11:40:42 EST 2020
On Tue, 2020-11-10 at 16:30 +0000, anton.ivanov at cambridgegreys.com
wrote:
> 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.
Nice! :-)
> diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> index 4b799fad8b48..961cf3af3ff0 100644
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -189,6 +189,17 @@ config UML_TIME_TRAVEL_SUPPORT
>
> It is safe to say Y, but you probably don't need this.
>
> +config UML_USE_HOST_STRINGS
> + bool
> + default y
> + prompt "Use glibc strings and memory functions"
> + help
> + UML runs as a normal userspace process. As a result it can use
> + the optimized strcpy, memcpy, etc from glibc instead of the
> + kernel generic equivalents. This provides some minimal speedup
> + in the 1% or so range for most applications. It also results in
> + a smaller executable.
Looks like some inconsistent tab/spaces indentation there :)
> +++ b/arch/um/os-Linux/string.c
> @@ -0,0 +1,78 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
> + */
> +
> +#include <stddef.h>
> +#include <unistd.h>
> +#include <string.h>
> +#include <os_string.h>
> +
> +inline char *os_strcpy(char *dest, const char *src)
those 'inline' annotations seem strange - they can't possibly do
anything useful here?
johannes
More information about the linux-um
mailing list