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

2021-03-24 Thread Minchan Kim
On Wed, Mar 24, 2021 at 03:37:02PM +0300, Dmitry Osipenko wrote: > 24.03.2021 08:44, Minchan Kim пишет: > > On Tue, Mar 23, 2021 at 09:47:27PM -0700, John Hubbard wrote: > >> On 3/23/21 8:27 PM, Minchan Kim wrote: > >> ... > > +static int __init cma_sysfs_init(void) > > +{ > > +

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

2021-03-24 Thread Minchan Kim
On Wed, Mar 24, 2021 at 03:33:07PM +0300, Dmitry Osipenko wrote: > 24.03.2021 04:05, Minchan Kim пишет: > > +static struct kobject *cma_kobj_root; > > This should be a local variable. Sure. > > > +static struct kobj_type cma_ktype = { > > + .release = cma_kobj_release, > > + .sysfs_ops =

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

2021-03-24 Thread Dmitry Osipenko
24.03.2021 08:44, Minchan Kim пишет: > On Tue, Mar 23, 2021 at 09:47:27PM -0700, John Hubbard wrote: >> On 3/23/21 8:27 PM, Minchan Kim wrote: >> ... > +static int __init cma_sysfs_init(void) > +{ > + unsigned int i; > + > + cma_kobj_root = kobject_create_and_add("cma",

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

2021-03-24 Thread Dmitry Osipenko
24.03.2021 04:05, Minchan Kim пишет: > +static struct kobject *cma_kobj_root; This should be a local variable. > +static struct kobj_type cma_ktype = { > + .release = cma_kobj_release, > + .sysfs_ops = _sysfs_ops, > + .default_groups = cma_groups I'd add a comma to the end, for

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

2021-03-24 Thread John Hubbard
On 3/23/21 11:57 PM, Minchan Kim wrote: ... , how about approximately this: struct cma_kobject_wrapper { struct cma *parent; struct kobject kobj; }; struct cma { ... struct cma_kobject_wrapper *cma_kobj_wrapper; }; ...thus allowing readers of cma_sysfs.c to read that

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

2021-03-24 Thread Minchan Kim
On Tue, Mar 23, 2021 at 11:26:08PM -0700, John Hubbard wrote: > On 3/23/21 10:44 PM, Minchan Kim wrote: > > On Tue, Mar 23, 2021 at 09:47:27PM -0700, John Hubbard wrote: > > > On 3/23/21 8:27 PM, Minchan Kim wrote: > > > ... > > > > > > +static int __init cma_sysfs_init(void) > > > > > > +{ > > >

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

2021-03-24 Thread John Hubbard
On 3/23/21 10:44 PM, Minchan Kim wrote: On Tue, Mar 23, 2021 at 09:47:27PM -0700, John Hubbard wrote: On 3/23/21 8:27 PM, Minchan Kim wrote: ... +static int __init cma_sysfs_init(void) +{ + unsigned int i; + + cma_kobj_root = kobject_create_and_add("cma", mm_kobj); + if

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

2021-03-23 Thread Minchan Kim
On Tue, Mar 23, 2021 at 09:47:27PM -0700, John Hubbard wrote: > On 3/23/21 8:27 PM, Minchan Kim wrote: > ... > > > > +static int __init cma_sysfs_init(void) > > > > +{ > > > > + unsigned int i; > > > > + > > > > + cma_kobj_root = kobject_create_and_add("cma", mm_kobj); > > > > +

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

2021-03-23 Thread John Hubbard
On 3/23/21 8:27 PM, Minchan Kim wrote: ... +static int __init cma_sysfs_init(void) +{ + unsigned int i; + + cma_kobj_root = kobject_create_and_add("cma", mm_kobj); + if (!cma_kobj_root) + return -ENOMEM; + + for (i = 0; i < cma_area_count; i++) { +

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

2021-03-23 Thread Minchan Kim
On Tue, Mar 23, 2021 at 07:34:12PM -0700, John Hubbard wrote: > On 3/23/21 6:05 PM, Minchan Kim wrote: > ...> diff --git a/mm/cma_sysfs.c b/mm/cma_sysfs.c > > new file mode 100644 > > index ..c3791a032dc5 > > --- /dev/null > > +++ b/mm/cma_sysfs.c > > @@ -0,0 +1,107 @@ > > +//

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

2021-03-23 Thread John Hubbard
On 3/23/21 6:05 PM, Minchan Kim wrote: ...> diff --git a/mm/cma_sysfs.c b/mm/cma_sysfs.c new file mode 100644 index ..c3791a032dc5 --- /dev/null +++ b/mm/cma_sysfs.c @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * CMA SysFS Interface + * + * Copyright (c) 2021 Minchan

[PATCH v6] mm: cma: support sysfs

2021-03-23 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 statistics for CMA, in order to provide some basic monitoring of the CMA allocator. * the number of CMA page