From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752488AbbCOXoo (ORCPT ); Sun, 15 Mar 2015 19:44:44 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34418 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889AbbCOXon (ORCPT ); Sun, 15 Mar 2015 19:44:43 -0400 Date: Mon, 16 Mar 2015 10:44:43 +1100 From: NeilBrown To: Torsten Kaiser Cc: Prakash Punnoor , LKML Subject: Re: udiskd high CPU usage with 4.0 git Message-ID: <20150316104443.491f4698@notabene.brown> In-Reply-To: References: <54FC837F.8070204@punnoor.de> <20150309103056.2dea3bf6@notabene.brown> X-Mailer: Claws Mail 3.10.1-162-g4d0ed6 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/T6YjdnQDJsSNsw2JQpGgXap"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/T6YjdnQDJsSNsw2JQpGgXap Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 14 Mar 2015 21:16:51 +0100 Torsten Kaiser wrote: > On Mon, Mar 9, 2015 at 12:30 AM, NeilBrown wrote: > > On Sun, 08 Mar 2015 18:14:39 +0100 Prakash Punnoor = 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 >=20 > I had the same problem upgrading from 4.0-rc1 to 4.0-rc3. > I have just finished bisecting and "fixing" it. >=20 > My bisect points to the same commit. >=20 > 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". >=20 > If I revert this part of the commit, my system works normal again: >=20 > static struct md_sysfs_entry md_scan_mode =3D > - __ATTR_PREALLOC(sync_action, S_IRUGO|S_IWUSR, action_show, action_store= ); > + __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); >=20 > It seems that polling is broken for peralloc files. >=20 > 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. >=20 > I fixed my local system by copying the line "of->event =3D > 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) >=20 > 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 --Sig_/T6YjdnQDJsSNsw2JQpGgXap Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIVAwUBVQYZaznsnt1WYoG5AQLdvA/8DrAQwkdzfJKgAQTNYXXF6ZQAHaql/UBf PBniOGQ6wD0QWk7oBKcqFPybC/HajYBrWHNVTQTH/iXHQolvcbtrfZ4E1xaDHpW0 S0pdhbtY2cuIHbO6zQSTrliL3Okr5tV5tjyusEXGaeDt9CWGc6UmfxTCdLiXOBMb vNFxXbm6YU50roDA13wZe0DChIibLXdLv9UvN3qmZcQqFPRGPdoUx8yLSrFE3mT8 LKL36jv/amIT25ni1e9giQ97fV51Kq+308DTUGWhENHmG1NOsJkrT/+NsPWDAGZB y+X8U4W2n97syo3qw7aRCUAS6+ph5KQRC3dN/JVqP1e3Q0SnTSCHdPNJwkF6CfTm tkcYXaPPUXM88+VJytws8Ls9aJsqdY4xSxRlPS5JJX9seWqUV9EZ2emtjhEWMCqV eM+liFXg/Bytk3bf/woiHuMnGjt1fRaiEEnQbSb+PfG36+ievnJCrvU9tus0aBg5 E6Fme/xDHgg6rGQ2Y/TfqiYAcihGCS+CuVUU1MadictZpM5dFhZFfIESM3HDovqa hh5x8SQnb35/MbBeZCpMoJdNflyblr7hue8tq4/nlyeoMWJi3WfGDaGl3pemZYjU oF6Vnl5oP29Qtrrs192ObSTazj9KH2WnYXZmQRUEnas5Mk4bVT/JsXmfJaiQ3qO6 GUkj7FG2Xpo= =asqw -----END PGP SIGNATURE----- --Sig_/T6YjdnQDJsSNsw2JQpGgXap--