[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200722103601.27454-1-sjpark@amazon.com>
Date: Wed, 22 Jul 2020 12:36:01 +0200
From: SeongJae Park <sjpark@...zon.com>
To: SeongJae Park <sjpark@...zon.com>
CC: <akpm@...ux-foundation.org>, SeongJae Park <sjpark@...zon.de>,
<Jonathan.Cameron@...wei.com>, <aarcange@...hat.com>,
<acme@...nel.org>, <alexander.shishkin@...ux.intel.com>,
<amit@...nel.org>, <benh@...nel.crashing.org>,
<brendan.d.gregg@...il.com>, <brendanhiggins@...gle.com>,
<cai@....pw>, <colin.king@...onical.com>, <corbet@....net>,
<david@...hat.com>, <dwmw@...zon.com>, <foersleo@...zon.de>,
<irogers@...gle.com>, <jolsa@...hat.com>, <kirill@...temov.name>,
<mark.rutland@....com>, <mgorman@...e.de>, <minchan@...nel.org>,
<mingo@...hat.com>, <namhyung@...nel.org>, <peterz@...radead.org>,
<rdunlap@...radead.org>, <riel@...riel.com>, <rientjes@...gle.com>,
<rostedt@...dmis.org>, <rppt@...nel.org>, <sblbir@...zon.com>,
<shakeelb@...gle.com>, <shuah@...nel.org>, <sj38.park@...il.com>,
<snu@...zon.de>, <vbabka@...e.cz>, <vdavydov.dev@...il.com>,
<yang.shi@...ux.alibaba.com>, <ying.huang@...el.com>,
<linux-damon@...zon.com>, <linux-mm@...ck.org>,
<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v18 09/14] mm/damon: Implement a debugfs interface
On Mon, 13 Jul 2020 10:41:39 +0200 SeongJae Park <sjpark@...zon.com> wrote:
> From: SeongJae Park <sjpark@...zon.de>
>
> This commit implements a debugfs interface for DAMON. It works for the
> virtual address spaces monitoring.
>
[...]
> +/*
> + * Converts a string into an array of unsigned long integers
> + *
> + * Returns an array of unsigned long integers if the conversion success, or
> + * NULL otherwise.
> + */
> +static int *str_to_pids(const char *str, ssize_t len, ssize_t *nr_pids)
> +{
> + int *pids;
> + const int max_nr_pids = 32;
> + int pid;
> + int pos = 0, parsed, ret;
> +
> + *nr_pids = 0;
> + pids = kmalloc_array(max_nr_pids, sizeof(pid), GFP_KERNEL);
> + if (!pids)
> + return NULL;
> + while (*nr_pids < max_nr_pids && pos < len) {
> + ret = sscanf(&str[pos], "%d%n", &pid, &parsed);
> + pos += parsed;
> + if (ret != 1)
> + break;
> + pids[*nr_pids] = pid;
> + *nr_pids += 1;
> + }
> + if (*nr_pids == 0) {
> + kfree(pids);
> + pids = NULL;
> + }
Hmm, this means debugfs users cannot make 'target_ids' empty again. I will fix
this in the next spin.
Thanks,
SeongJae Park
Powered by blists - more mailing lists