lkml.org 
[lkml]   [2020]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Re: Re: [PATCH v6 02/14] mm/damon: Implement region based sampling
Date
On Fri, 13 Mar 2020 21:16:49 +0100 SeongJae Park <sj38.park@gmail.com> wrote:

> On Fri, 13 Mar 2020 17:29:54 +0000 Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
>
> > On Mon, 24 Feb 2020 13:30:35 +0100
> > SeongJae Park <sjpark@amazon.com> wrote:
> >
> > > From: SeongJae Park <sjpark@amazon.de>
> > >
> > > This commit implements DAMON's basic access check and region based
> > > sampling mechanisms. This change would seems make no sense, mainly
> > > because it is only a part of the DAMON's logics. Following two commits
> > > will make more sense.
> > >
> [...]
> >
> > Came across a minor issue inline. kthread_run calls kthread_create.
> > That gives a potential sleep while atomic issue given the spin lock.
> >
> > Can probably be fixed by preallocating the thread then starting it later.
> >
> > Jonathan
> [...]
> > > +/*
> > > + * Start or stop the kdamond
> > > + *
> > > + * Returns 0 if success, negative error code otherwise.
> > > + */
> > > +static int damon_turn_kdamond(struct damon_ctx *ctx, bool on)
> > > +{
> > > + spin_lock(&ctx->kdamond_lock);
> > > + ctx->kdamond_stop = !on;
> > > + if (!ctx->kdamond && on) {
> > > + ctx->kdamond = kthread_run(kdamond_fn, ctx, "kdamond");
> >
> > Can't do this under a spin lock.
>
> Good catch! And, agree to your suggestion. I will fix this in that way!

I changed my mind. I would like to simply use mutex instead of spinlock, as
khugepaged also does. If you have different opinion, please let me know.


Thanks,
SeongJae Park

>
>
> Thanks,
> SeongJae Park

\
 
 \ /
  Last update: 2020-03-17 12:33    [W:1.015 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site