From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Nikolay Borisov <n.borisov-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
Cc: Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org,
jack-AlSwsSmVLrQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kernel-team-b10kYP2dOMg@public.gmane.org
Subject: Re: [PATCH 4/5] kernfs: implement kernfs_path_len()
Date: Thu, 9 Jul 2015 17:41:43 -0400 [thread overview]
Message-ID: <20150709214143.GD18734@mtj.duckdns.org> (raw)
In-Reply-To: <559CDA8B.6040909-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
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
WARNING: multiple messages have this Message-ID (diff)
From: Tejun Heo <tj@kernel.org>
To: Nikolay Borisov <n.borisov@siteground.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
axboe@kernel.dk, jack@suse.cz, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 4/5] kernfs: implement kernfs_path_len()
Date: Thu, 9 Jul 2015 17:41:43 -0400 [thread overview]
Message-ID: <20150709214143.GD18734@mtj.duckdns.org> (raw)
In-Reply-To: <559CDA8B.6040909@siteground.com>
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
next prev parent reply other threads:[~2015-07-09 21:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 15:10 [PATCHSET block/for-4.3] writeback: cgroup writeback updates Tejun Heo
2015-07-07 15:10 ` Tejun Heo
2015-07-07 15:10 ` [PATCH 1/5] writeback: bdi_for_each_wb() iteration is memcg ID based not blkcg Tejun Heo
[not found] ` <1436281823-1947-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-07-07 15:10 ` [PATCH 2/5] writeback: remove wb_writeback_work->single_wait/done Tejun Heo
2015-07-07 15:10 ` Tejun Heo
2015-07-07 15:10 ` [PATCH 3/5] writeback: explain why @inode is allowed to be NULL for inode_congested() Tejun Heo
2015-07-07 15:10 ` Tejun Heo
2015-07-07 15:10 ` [PATCH 4/5] kernfs: implement kernfs_path_len() Tejun Heo
2015-07-07 15:12 ` Tejun Heo
[not found] ` <20150707151218.GB23362-qYNAdHglDFBN0TnZuCh8vA@public.gmane.org>
2015-07-07 22:39 ` Greg Kroah-Hartman
2015-07-07 22:39 ` Greg Kroah-Hartman
[not found] ` <559CDA8B.6040909@siteground.com>
[not found] ` <559CDA8B.6040909-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org>
2015-07-09 21:41 ` Tejun Heo [this message]
2015-07-09 21:41 ` Tejun Heo
2015-07-07 15:10 ` [PATCH 5/5] writeback: update writeback tracepoints to report cgroup Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150709214143.GD18734@mtj.duckdns.org \
--to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=jack-AlSwsSmVLrQ@public.gmane.org \
--cc=kernel-team-b10kYP2dOMg@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=n.borisov-/eCPMmvKun9pLGFMi4vTTA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.