All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>
To: Johannes Berg <johannes@sipsolutions.net>, linux-um@lists.infradead.org
Cc: richard@nod.at
Subject: Re: [PATCH] um: allow using glibc string functions instead of generics
Date: Tue, 10 Nov 2020 16:54:55 +0000	[thread overview]
Message-ID: <1437c737-815f-c8ad-b45f-f88f398dadba@cambridgegreys.com> (raw)
In-Reply-To: <ca9a4a3d2e6c49cc609db33637089e9110662174.camel@sipsolutions.net>



On 10/11/2020 16:40, Johannes Berg wrote:
> On Tue, 2020-11-10 at 16:30 +0000, anton.ivanov@cambridgegreys.com
> wrote:
>> From: Anton Ivanov <anton.ivanov@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 :)

Will fix it in v2.

> 
>> +++ 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?

Indeed. The compiler inlines them anyway. I can remove that. There is no difference (I tried both).


> 
> johannes
> 
> 

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

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


  reply	other threads:[~2020-11-10 16:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 16:30 [PATCH] um: allow using glibc string functions instead of generics anton.ivanov
2020-11-10 16:40 ` Johannes Berg
2020-11-10 16:54   ` Anton Ivanov [this message]
2020-11-10 20:13 ` Richard Weinberger
2020-11-10 20:56   ` Anton Ivanov
2020-11-10 21:29     ` Richard Weinberger
2020-11-10 21:33       ` Anton Ivanov
2020-11-10 21:39         ` Richard Weinberger
2020-11-11  7:13           ` Anton Ivanov
2020-11-11  8:26             ` Anton Ivanov
2020-11-11 15:14             ` Anton Ivanov
2020-11-11 15:59               ` Anton Ivanov
2020-11-11 18:09               ` Anton Ivanov
2020-11-11  9:49           ` Anton Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437c737-815f-c8ad-b45f-f88f398dadba@cambridgegreys.com \
    --to=anton.ivanov@cambridgegreys.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.