Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread John Hubbard
On 2/9/21 11:26 PM, Greg KH wrote: ... I just am not especially happy about the inability to do natural, efficient things here, such as use a statically allocated set of things with sysfs. And I remain convinced that the above is not "improper"; it's a reasonable step, given the limitations of

Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread Greg KH
On Tue, Feb 09, 2021 at 11:16:07PM -0800, John Hubbard wrote: > On 2/9/21 11:12 PM, Minchan Kim wrote: > ... > > > > Agreed. How about this for the warning part? > > > > > > > > + > > > > +/* > > > > + * note: kobj_type should provide a release function to free > > > > dynamically > > > > + *

Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread John Hubbard
On 2/9/21 11:12 PM, Minchan Kim wrote: ... Agreed. How about this for the warning part? + +/* + * note: kobj_type should provide a release function to free dynamically + * allocated object since kobject is responsible for controlling lifespan + * of the object. However, cma_area is static

Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread Minchan Kim
On Wed, Feb 10, 2021 at 07:43:37AM +0100, Greg KH wrote: > On Tue, Feb 09, 2021 at 01:13:17PM -0800, Minchan Kim wrote: > > On Tue, Feb 09, 2021 at 12:11:20PM -0800, John Hubbard wrote: > > > On 2/9/21 9:49 AM, Greg KH wrote: > > > > > > That's fine if you want to add it to the parent. If so,

Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread Greg KH
On Tue, Feb 09, 2021 at 01:13:17PM -0800, Minchan Kim wrote: > On Tue, Feb 09, 2021 at 12:11:20PM -0800, John Hubbard wrote: > > On 2/9/21 9:49 AM, Greg KH wrote: > > > > > That's fine if you want to add it to the parent. If so, then the > > > > > kobject controls the lifetime of the structure,

Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread Minchan Kim
On Tue, Feb 09, 2021 at 12:11:20PM -0800, John Hubbard wrote: > On 2/9/21 9:49 AM, Greg KH wrote: > > > > That's fine if you want to add it to the parent. If so, then the > > > > kobject controls the lifetime of the structure, nothing else can. > > > > > > The problem was parent object(i.e.,

Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread John Hubbard
On 2/9/21 9:49 AM, Greg KH wrote: That's fine if you want to add it to the parent. If so, then the kobject controls the lifetime of the structure, nothing else can. The problem was parent object(i.e., struct cma cma_areas) is static arrary so kobj->release function will be NULL or just dummy.

Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread Greg KH
On Tue, Feb 09, 2021 at 07:55:59AM -0800, Minchan Kim wrote: > On Tue, Feb 09, 2021 at 07:56:30AM +0100, Greg KH wrote: > > On Mon, Feb 08, 2021 at 10:34:51PM -0800, John Hubbard wrote: > > > On 2/8/21 10:27 PM, John Hubbard wrote: > > > > On 2/8/21 10:13 PM, Greg KH wrote: > > > > > On Mon, Feb

Re: [PATCH v2] mm: cma: support sysfs

2021-02-09 Thread Minchan Kim
On Tue, Feb 09, 2021 at 07:56:30AM +0100, Greg KH wrote: > On Mon, Feb 08, 2021 at 10:34:51PM -0800, John Hubbard wrote: > > On 2/8/21 10:27 PM, John Hubbard wrote: > > > On 2/8/21 10:13 PM, Greg KH wrote: > > > > On Mon, Feb 08, 2021 at 05:57:17PM -0800, John Hubbard wrote: > > > > > On 2/8/21

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread Greg KH
On Mon, Feb 08, 2021 at 10:34:51PM -0800, John Hubbard wrote: > On 2/8/21 10:27 PM, John Hubbard wrote: > > On 2/8/21 10:13 PM, Greg KH wrote: > > > On Mon, Feb 08, 2021 at 05:57:17PM -0800, John Hubbard wrote: > > > > On 2/8/21 3:36 PM, Minchan Kim wrote: > > > > ... > > > > > > >     char

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread John Hubbard
On 2/8/21 10:27 PM, John Hubbard wrote: On 2/8/21 10:13 PM, Greg KH wrote: On Mon, Feb 08, 2021 at 05:57:17PM -0800, John Hubbard wrote: On 2/8/21 3:36 PM, Minchan Kim wrote: ...     char name[CMA_MAX_NAME]; +#ifdef CONFIG_CMA_SYSFS +    struct cma_stat    *stat; This should not be a

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread John Hubbard
On 2/8/21 10:13 PM, Greg KH wrote: On Mon, Feb 08, 2021 at 05:57:17PM -0800, John Hubbard wrote: On 2/8/21 3:36 PM, Minchan Kim wrote: ... char name[CMA_MAX_NAME]; +#ifdef CONFIG_CMA_SYSFS + struct cma_stat *stat; This should not be a pointer. By making it a pointer, you've

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread Greg KH
On Mon, Feb 08, 2021 at 05:57:17PM -0800, John Hubbard wrote: > On 2/8/21 3:36 PM, Minchan Kim wrote: > ... > > > > char name[CMA_MAX_NAME]; > > > > +#ifdef CONFIG_CMA_SYSFS > > > > + struct cma_stat *stat; > > > > > > This should not be a pointer. By making it a pointer, you've

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread John Hubbard
On 2/8/21 9:18 PM, John Hubbard wrote: On 2/8/21 8:19 PM, Minchan Kim wrote: On Mon, Feb 08, 2021 at 05:57:17PM -0800, John Hubbard wrote: On 2/8/21 3:36 PM, Minchan Kim wrote: ...     char name[CMA_MAX_NAME]; +#ifdef CONFIG_CMA_SYSFS +    struct cma_stat    *stat; This should not be a

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread John Hubbard
On 2/8/21 8:19 PM, Minchan Kim wrote: On Mon, Feb 08, 2021 at 05:57:17PM -0800, John Hubbard wrote: On 2/8/21 3:36 PM, Minchan Kim wrote: ... char name[CMA_MAX_NAME]; +#ifdef CONFIG_CMA_SYSFS + struct cma_stat *stat; This should not be a pointer. By making it a pointer, you've

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread Minchan Kim
On Mon, Feb 08, 2021 at 05:57:17PM -0800, John Hubbard wrote: > On 2/8/21 3:36 PM, Minchan Kim wrote: > ... > > > > char name[CMA_MAX_NAME]; > > > > +#ifdef CONFIG_CMA_SYSFS > > > > + struct cma_stat *stat; > > > > > > This should not be a pointer. By making it a pointer, you've

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread John Hubbard
On 2/8/21 3:36 PM, Minchan Kim wrote: ... char name[CMA_MAX_NAME]; +#ifdef CONFIG_CMA_SYSFS + struct cma_stat *stat; This should not be a pointer. By making it a pointer, you've added a bunch of pointless extra code to the implementation. Originally, I went with the object

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread Minchan Kim
On Mon, Feb 08, 2021 at 01:34:06PM -0800, John Hubbard wrote: > On 2/8/21 10:01 AM, Minchan Kim wrote: > > Since CMA is getting used more widely, it's more important to > > keep monitoring CMA statistics for system health since it's > > directly related to user experience. > > > > This patch

Re: [PATCH v2] mm: cma: support sysfs

2021-02-08 Thread John Hubbard
On 2/8/21 10:01 AM, Minchan Kim wrote: Since CMA is getting used more widely, it's more important to keep monitoring CMA statistics for system health since it's directly related to user experience. This patch introduces sysfs for the CMA and exposes stats below to keep monitor for telemetric in

[PATCH v2] mm: cma: support sysfs

2021-02-08 Thread Minchan Kim
Since CMA is getting used more widely, it's more important to keep monitoring CMA statistics for system health since it's directly related to user experience. This patch introduces sysfs for the CMA and exposes stats below to keep monitor for telemetric in the system. * the number of CMA page