From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965028AbcBQCa1 (ORCPT ); Tue, 16 Feb 2016 21:30:27 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47318 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752260AbcBQCa0 (ORCPT ); Tue, 16 Feb 2016 21:30:26 -0500 Date: Tue, 16 Feb 2016 18:30:25 -0800 From: Greg Kroah-Hartman To: David Ahern Cc: Edward Cree , linux-kernel@vger.kernel.org Subject: Re: Idea for reducing sysfs memory usage Message-ID: <20160217023025.GB26016@kroah.com> References: <56C3B4E9.7030207@cantab.net> <20160216235502.GA14565@kroah.com> <56C3C0D2.9090407@cantab.net> <56C3C286.9070307@cumulusnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56C3C286.9070307@cumulusnetworks.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 16, 2016 at 05:44:54PM -0700, David Ahern wrote: > On 2/16/16 5:37 PM, Edward Cree wrote: > >On 16/02/16 23:55, Greg Kroah-Hartman wrote: > >>On Tue, Feb 16, 2016 at 11:46:49PM +0000, Edward Cree wrote: > >>>Sorry if this has been suggested before, but if so I couldn't find it. > >>>Short version: could a sysfs dir reference a list of default attributes > >>>rather than having to instantiate them all? > >>Shorter version, why do you think it is? :) > >> > >>Have you done some testing of the amount of memory that sysfs entries > >>consume and found any problems with it? > >Two reasons: > >a) in his netdev1.1 talk "Scaling the Number of Network Interfaces on > >Linux", > > David Ahern claimed a memory overhead of (iirc) about 45kB per > >netdevice, > > of which he attributed (again, iirc) about 20kB to sysfs entries. He > >also > > indicated that this was a problem for his use case. (My apologies to > > David if I've misrepresented him. CCed him so he can correct me.) > > Close enough. :-) > > I analyzed memory allocations for the creation of a dummy netdevice. All > total 36,450 bytes were requested resulting in 43,944 bytes allocated. Of > that kobject and sysfs is 14,568. So kobject and sysfs is roughly 1/3 the > memory overhead of a netdevice and is also a significant overhead in the > time to create the netdevice. Time? Hm, I thought we reduced the time down by a lot a few years ago, any pointers to where we are spending too much time? The PPC people did some work on our list traversal issues for thousands of devices, perhaps that doesn't scale to 10s of thousands? As for 1/3 the memory needed, is that acceptable given all that the interface and functionality that the code gives you? 14k does seem pretty large to me, how many attributes/files are assigned to each device? thanks, greg k-h