lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1259251632.26705.17.camel@wall-e>
Date:	Thu, 26 Nov 2009 17:07:12 +0100
From:	Stefani Seibold <stefani@...bold.net>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	Arnd Bergmann <arnd@...db.de>,
	Andi Kleen <andi@...stfloor.org>,
	Amerigo Wang <xiyou.wangcong@...il.com>,
	Joe Perches <joe@...ches.com>,
	Roger Quadros <quadros.roger@...il.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Mauro Carvalho Chehab <mchehab@...hat.com>
Subject: Re: [PATCH 7/7] kfifo: add record handling functions


> > +static inline unsigned int __kfifo_out_rec(struct kfifo *fifo,
> > +	void *to, unsigned int n, unsigned int recsize,
> > +	unsigned int *total)
> > +{
> > +	unsigned int l;
> > +
> > +	if (!recsize) {
> > +		l = n;
> > +		if (total)
> > +			*total = l;
> > +	} else {
> > +		l = __kfifo_peek_n(fifo, recsize);
> > +		if (total)
> > +			*total = l;
> > +		if (n < l)
> > +			return l;
> > +	}
> > +
> > +	return __kfifo_out_n(fifo, to, l, recsize);
> > +}
> 
> The amount of inlining in this header is pretty wild.  These are large
> functions!  Inlining them will create a large kernel and most likely a
> slower one, due to the increased instruction cache footprint.
> 
> So please, let's see a "kfifo: uninline everything" patch?  
> 
> but...
> 
> > +/**
> > + * kfifo_out_rec - gets some record data from the FIFO
> > + * @fifo: the fifo to be used.
> > + * @to: where the data must be copied.
> > + * @n: the size of the destination buffer.
> > + * @recsize: size of record field
> > + * @total: pointer where the total number of to copied bytes should stored
> > + *
> > + * This function copies at most @n bytes from the FIFO to @to and returns the
> > + * number of bytes which cannot be copied.
> > + * A returned value greater than the @n value means that the record doesn't
> > + * fit into the @to buffer.
> > + *
> > + * Note that with only one concurrent reader and one concurrent
> > + * writer, you don't need extra locking to use these functions.
> > + */
> > +static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo,
> > +	void *to, unsigned int n, unsigned int recsize,
> > +	unsigned int *total)
> > +
> > +{
> > +	if (!__builtin_constant_p(recsize))
> > +		return __kfifo_out_generic(fifo, to, n, recsize, total);
> > +	return __kfifo_out_rec(fifo, to, n, recsize, total);
> > +}
> 
> OK, so I see that some attention has been paid to the text footprint issue.
> 
> But how much, and was it successful?
> 

I analyzed the code and most of them will be optimized away by the
compiler. The reason for this design decision was that i want no
performance regression against the old kfifo implementation.

But if the majority vote for an non inline version i will do it. It will
make the code more readable and slim down the footprint.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ