This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Variations of memset()


On 08/04/2017 03:18 PM, Alexander Monakov wrote:
> On Fri, 4 Aug 2017, Jeff Law wrote:
>>> I've identified three places in the Linux kernel which are quite
>>> dissimilar that can make use of such functions.
>>>
>>> 1. Initialising an array of uint32_t to a particular value.  This is part
>>> of the Symbios SCSI driver.  It is initialisation code.  This benefits
>>> from smaller code size
>>>
>>> 2. Decompression in the zram driver.  The zram driver can compress a page
>>> of RAM which consists entirely of a repeated pattern (up to the size of a
>>> 'long').  This benefits from the speed of memset_l.
>> So for these cases would it make more sense for the compiler to identify
>> the initialization loop and have it call into the new routines in glibc
>> rather than changing the kernel or various applications to call those
>> routines.
> 
> The Linux kernel does not (and cannot) link against Glibc at all...

What matters is that the compiler turns the initialization into a call to an 
implementation dependent symbol.

Where the implementation comes from can vary. In userspace it can come from
glibc, in the kernel it can come from some other object file.

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]