All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Torsten Kaiser <just.for.lkml@googlemail.com>
Cc: Prakash Punnoor <prakash@punnoor.de>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: udiskd high CPU usage with 4.0 git
Date: Mon, 16 Mar 2015 10:44:43 +1100	[thread overview]
Message-ID: <20150316104443.491f4698@notabene.brown> (raw)
In-Reply-To: <CAPVoSvT9fBuA9QrrjbK3HCi0frWRQXHR0Y-BUntwr0Vam-_cBA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]

On Sat, 14 Mar 2015 21:16:51 +0100 Torsten Kaiser
<just.for.lkml@googlemail.com> wrote:

> On Mon, Mar 9, 2015 at 12:30 AM, NeilBrown <neilb@suse.de> wrote:
> > On Sun, 08 Mar 2015 18:14:39 +0100 Prakash Punnoor <prakash@punnoor.de> wrote:
> >
> >> Hi,
> >>
> >> I noticed the udisks daemon (version 2.1.4) suddenly started using high
> >> cpu (one core at 100%) with linux 4.0 git kernel. I bisected it to:
> >>
> >> 750f199ee8b578062341e6ddfe36c59ac8ff2dcb
> 
> I had the same problem upgrading from 4.0-rc1 to 4.0-rc3.
> I have just finished bisecting and "fixing" it.
> 
> My bisect points to the same commit.
> 
> Looking at udisksd with strace sees a loop of polling and then
> accessing several md related sysfs files.
> The only file that udisksd monitors and was changes by that commit was
> "sync_action".
> 
> If I revert this part of the commit, my system works normal again:
> 
>  static struct md_sysfs_entry md_scan_mode =
> - __ATTR_PREALLOC(sync_action, S_IRUGO|S_IWUSR, action_show, action_store);
> + __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store);
> 
> It seems that polling is broken for peralloc files.
> 
> The cause seems to be that kernfs_seq_show() updates ->event, while
> the new sysfs_kf_read() does not.
> So the polling will always trigger and udisksd goes into an inifinite
> loop looking for changes that are not there.
> 
> I fixed my local system by copying the line "of->event =
> atomic_read(&of->kn->attr.open->event);" from kernfs_seq_show() into
> sysfs_kf_read(). (I also needed to move the definition of struct
> kernfs_open_node from kernfs/file.c to kefs-internal.h)
> 
> udisksd now again behaves normal, but I'm not sending this change as a
> patch, because I do not know about the locking and livetime of these
> objects to evaluate, if that is really the correct fix.

Thanks for the bisection and analysis!  Always easier when someone else does
the hard work :-)

There is a much simpler patch (as you probably suspected).  I'll post it in a
moment.

Thank,
NeilBrown

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2015-03-15 23:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08 17:14 udiskd high CPU usage with 4.0 git Prakash Punnoor
2015-03-08 23:30 ` NeilBrown
2015-03-09 15:46   ` Prakash Punnoor
2015-03-15 23:43     ` NeilBrown
2015-03-14 20:16   ` Torsten Kaiser
2015-03-15 23:44     ` NeilBrown [this message]
2015-03-16  7:16       ` Torsten Kaiser

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=20150316104443.491f4698@notabene.brown \
    --to=neilb@suse.de \
    --cc=just.for.lkml@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prakash@punnoor.de \
    /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.