[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230527020851.7855-1-sj@kernel.org>
Date: Fri, 26 May 2023 19:08:51 -0700
From: SeongJae Park <sj@...nel.org>
To: Kefeng Wang <wangkefeng.wang@...wei.com>
Cc: SeongJae Park <sj@...nel.org>,
syzbot <syzbot+841a46899768ec7bec67@...kaller.appspotmail.com>,
akpm@...ux-foundation.org, damon@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [damon?] divide error in damon_set_attrs
On Sat, 27 May 2023 10:02:38 +0800 Kefeng Wang <wangkefeng.wang@...wei.com> wrote:
>
>
> On 2023/5/27 9:46, SeongJae Park wrote:
> > Hi Kefeng,
> >
> > On Sat, 27 May 2023 09:15:01 +0800 Kefeng Wang <wangkefeng.wang@...wei.com> wrote:
> >
> > [...]
> >>>
> >>> Nice and effective fix! Nevertheless, I think aggregation interval smaller
> >>> than sample interval is just a wrong input. How about adding the check in
> >>> damon_set_attrs()'s already existing attributes validation, like below?
> >>
> >> Yes, move the check into damon_set_attrs() is better
> >
> > Thank you for this kind comment!
> >
> >> , and it seems that
> >> we could move all the check into it, and drop the old_attrs check in
> >> damon_update_monitoring_results(), what's you option?
> >>
> >>
> >> diff --git a/mm/damon/core.c b/mm/damon/core.c
> >> index d9ef62047bf5..1647f7f1f708 100644
> >> --- a/mm/damon/core.c
> >> +++ b/mm/damon/core.c
> >> @@ -523,12 +523,6 @@ static void damon_update_monitoring_results(struct
> >> damon_ctx *ctx,
> >> struct damon_target *t;
> >> struct damon_region *r;
> >>
> >> - /* if any interval is zero, simply forgive conversion */
> >> - if (!old_attrs->sample_interval || !old_attrs->aggr_interval ||
> >> - !new_attrs->sample_interval ||
> >> - !new_attrs->aggr_interval)
> >> - return;
> >> -
> >> damon_for_each_target(t, ctx)
> >> damon_for_each_region(r, t)
> >> damon_update_monitoring_result(
> >> @@ -551,6 +545,10 @@ int damon_set_attrs(struct damon_ctx *ctx, struct
> >> damon_attrs *attrs)
> >> return -EINVAL;
> >> if (attrs->min_nr_regions > attrs->max_nr_regions)
> >> return -EINVAL;
> >> + if (attrs->sample_interval > attrs->aggr_interval)
> >> + return -EINVAL;
> >> + if (!attrs->sample_interval || !attrs->aggr_interval)
> >> + return -EINVAL;
> >
> > In my humble opinion, the validation for monitoring results and for general
> > monitoring could be different. For example, zero aggreation/sampling intervals
> > might make sense for fixed granularity working set size monitoring. Hence, I'd
> > prefer keeping those checks in the damon_update_monitoring_results().
>
>
> ok, will keep that,
Thank you for agreeing.
> I check the damon_set_attrs() called by
> lru_sort/reclaim monitor and sysfs/dbgfs, the above changes should be
> ok, maybe missing something, the working set size monitoring is not
> public for now?
You're correct. Working set size monitoring is not somewhat currently
publicly exists, but only possible usage of DAMON at the moment.
Thanks,
SJ
[...]
Powered by blists - more mailing lists