From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Jenkins Date: Tue, 21 Oct 2008 11:48:30 +0000 Subject: Re: [PATCH] libudev: Allocate udev_device->envp lazily Message-Id: <48FDC18E.5010609@tuffmail.co.uk> List-Id: References: <48FDAADD.3000809@tuffmail.co.uk> In-Reply-To: <48FDAADD.3000809@tuffmail.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Kay Sievers wrote: > On Tue, Oct 21, 2008 at 12:11, Alan Jenkins wrote: > >> Allocate udev_device->envp lazily >> >> It's a pity to allocate 128 words when we don't need them. >> Measured 2% _user_ cpu time reduction on EeePC coldplug. >> > > Any idea what might take 2% here? We don't do anything if the envp > isn't used. We do almost the same thing with or without the patch > besides that "struct udev_device" is 1016 bytes smaller now, and we > malloc() it. > > Kay > oprofile said malloc() went down by about that much. I measured on top of threaded udevd, so I might be unlucky and chasing overheads you don't see in the single-threaded implementation :). By rights it should reduce memset() (or calloc now). And it might help with caching, because the array effectively splits udev_device in two. Using memory more compactly can reduce page faults, but I don't think that was significant. Alan