[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20150709214143.GD18734@mtj.duckdns.org>
Date: Thu, 9 Jul 2015 17:41:43 -0400
From: Tejun Heo <tj@...nel.org>
To: Nikolay Borisov <n.borisov@...eground.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, axboe@...nel.dk,
jack@...e.cz, linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH 4/5] kernfs: implement kernfs_path_len()
Hello, Nioklay.
I restored the cc list. Please use reply-to-all.
On Wed, Jul 08, 2015 at 11:08:43AM +0300, Nikolay Borisov wrote:
> > +size_t kernfs_path_len(struct kernfs_node *kn)
> > +{
> > + size_t len = 0;
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&kernfs_rename_lock, flags);
> > +
> > + do {
> > + len += strlen(kn->name) + 1;
> > + kn = kn->parent;
> > + } while (kn && kn->parent);
> > +
> > + spin_unlock_irqrestore(&kernfs_rename_lock, flags);
> > +
> > + return len;
> > +}
> > +
>
> Can you explain the reason why you need to disable the irqs while
> executing this function? Presumably it has to do with the context of its
> usage - tracepoints but I wasn't able to find any information about the
> implications of interrupts being enabled while in a trace point?
It doesn't have much to do with the specific usage.
kernfs_rename_lock is irq-safe because we want to be able to call
functions like kernfs_name() and kernfs_path() regardless of the
current context.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists