Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753989Ab0HYUji (ORCPT ); Wed, 25 Aug 2010 16:39:38 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:18778 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183Ab0HYUjf (ORCPT >); Wed, 25 Aug 2010 16:39:35 -0400 Date: Wed, 25 Aug 2010 16:37:08 -0400 From: Konrad Rzeszutek Wilk To: Michal Nazarewicz Cc: linux-mm@kvack.org, Daniel Walker , FUJITA Tomonori , Hans Verkuil , Jonathan Corbet , Kyungmin Park , Marek Szyprowski , Mark Brown , Pawel Osciak , Russell King , Zach Pfeffer , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH/RFCv4 3/6] mm: cma: Added SysFS support Message-ID: <20100825203707.GB5318@phenom.dumpdata.com> References: <0b02e05fc21e70a3af39e65e628d117cd89d70a1.1282286941.git.m.nazarewicz@samsung.com> <343f4b0edf9b5eef598831700cb459cd428d3f2e.1282286941.git.m.nazarewicz@samsung.com> <9883433f103cc84e55db150806d2270200c74c6b.1282286941.git.m.nazarewicz@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9883433f103cc84e55db150806d2270200c74c6b.1282286941.git.m.nazarewicz@samsung.com> User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5519 Lines: 152 On Fri, Aug 20, 2010 at 11:50:43AM +0200, Michal Nazarewicz wrote: > The SysFS development interface lets one change the map attribute > at run time as well as observe what regions have been reserved. > > Signed-off-by: Michal Nazarewicz > Signed-off-by: Kyungmin Park > --- > .../ABI/testing/sysfs-kernel-mm-contiguous | 53 +++ > Documentation/contiguous-memory.txt | 4 + > include/linux/cma.h | 7 + > mm/Kconfig | 18 +- > mm/cma.c | 345 +++++++++++++++++++- > 5 files changed, 423 insertions(+), 4 deletions(-) > create mode 100644 Documentation/ABI/testing/sysfs-kernel-mm-contiguous > > diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-contiguous b/Documentation/ABI/testing/sysfs-kernel-mm-contiguous > new file mode 100644 > index 0000000..8df15bc > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-kernel-mm-contiguous > @@ -0,0 +1,53 @@ > +What: /sys/kernel/mm/contiguous/ > +Date: August 2010 > +Contact: Michal Nazarewicz > +Description: > + If CMA has been built with SysFS support, > + /sys/kernel/mm/contiguous/ contains a file called > + "map", a file called "allocators" and a directory > + called "regions". > + > + The "map" file lets one change the CMA's map attribute > + at run-time. > + > + The "allocators" file list all registered allocators. > + Allocators with no name are listed as a single minus > + sign. > + > + The "regions" directory list all reserved regions. > + > + For more details see > + Documentation/contiguous-memory.txt. > + > +What: /sys/kernel/mm/contiguous/regions/ > +Date: August 2010 > +Contact: Michal Nazarewicz > +Description: > + The /sys/kernel/mm/contiguous/regions/ directory > + contain directories for each registered CMA region. > + The name of the directory is the same as the start > + address of the region. > + > + If region is named there is also a symbolic link named > + like the region pointing to the region's directory. > + > + Such directory contains the following files: > + > + * "name" -- the name of the region or an empty file > + * "start" -- starting address of the region (formatted > + with %p, ie. hex). > + * "size" -- size of the region (in bytes). > + * "free" -- free space in the region (in bytes). > + * "users" -- number of chunks allocated in the region. > + * "alloc" -- name of the allocator. > + > + If allocator is not attached to the region, "alloc" is > + either the name of desired allocator in square > + brackets (ie. "[foo]") or an empty file if region is > + to be attached to default allocator. If an allocator > + is attached to the region. "alloc" is either its name > + or "-" if attached allocator has no name. > + > + If there are no chunks allocated in given region > + ("users" is "0") then a name of desired allocator can > + be written to "alloc". > diff --git a/Documentation/contiguous-memory.txt b/Documentation/contiguous-memory.txt > index 8fc2400..8d189b8 100644 > --- a/Documentation/contiguous-memory.txt > +++ b/Documentation/contiguous-memory.txt > @@ -256,6 +256,10 @@ > iff it matched in previous pattern. If the second part is > omitted it will mach any type of memory requested by device. > > + If SysFS support is enabled, this attribute is accessible via > + SysFS and can be changed at run-time by writing to > + /sys/kernel/mm/contiguous/map. > + > Some examples (whitespace added for better readability): > > cma_map = foo/quaz = r1; > diff --git a/include/linux/cma.h b/include/linux/cma.h > index cd63f52..eede28d 100644 > --- a/include/linux/cma.h > +++ b/include/linux/cma.h > @@ -17,6 +17,9 @@ > > #include > #include > +#if defined CONFIG_CMA_SYSFS > +# include > +#endif > > > struct device; > @@ -203,6 +206,10 @@ struct cma_region { > unsigned users; > struct list_head list; > > +#if defined CONFIG_CMA_SYSFS > + struct kobject kobj; > +#endif > + > unsigned used:1; > unsigned registered:1; > unsigned reserved:1; > diff --git a/mm/Kconfig b/mm/Kconfig > index 3e9317c..ac0bb08 100644 > --- a/mm/Kconfig > +++ b/mm/Kconfig > @@ -319,12 +319,26 @@ config CMA > To make use of CMA you need to specify the regions and > driver->region mapping on command line when booting the kernel. > > -config CMA_DEBUG > - bool "CMA debug messages (DEVELOPEMENT)" > +config CMA_DEVELOPEMENT > + bool "Include CMA developement features" > depends on CMA > help > + This lets you enable some developement features of the CMA > + freamework. > + > +config CMA_DEBUG > + bool "CMA debug messages" > + depends on CMA_DEVELOPEMENT > + help > Enable debug messages in CMA code. > > +config CMA_SYSFS > + bool "CMA SysFS interface support" > + depends on CMA_DEVELOPEMENT > + help > + Enable support for SysFS interface. Whats the rationale for having those #ifdef CONFIG_CMA_SYSFS sprinkled in the C code? Is SysFS not used on StrongARM? Why not implicitly include the SysFS support? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/