Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1406556
| Path | csiph.com!goblin2!goblin1!goblin.stu.neva.ru!nntpspool.opticnetworks.net!nntpspool01.opticnetworks.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Waiman Long <waiman.long@hpe.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE |
| Date | Wed, 25 May 2016 03:30:02 +0200 |
| Message-ID | <rCvO2-2Kd-15@gated-at.bofh.it> (permalink) |
| References | <rzYtc-3J2-3@gated-at.bofh.it> <rzYtc-3J2-7@gated-at.bofh.it> <rAakG-39y-23@gated-at.bofh.it> <rAdsj-54h-25@gated-at.bofh.it> <rAfNn-6pu-13@gated-at.bofh.it> <rAfNn-6pu-11@gated-at.bofh.it> <rBhDs-5HD-11@gated-at.bofh.it> <rC35o-13f-29@gated-at.bofh.it> |
| X-Original-To | Jason Low <jason.low2@hpe.com> |
| Authentication-Results | hpe.com; dkim=none (message not signed) header.d=none;hpe.com; dmarc=none action=none header.from=hpe.com; |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8"; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Originating-IP | [71.168.64.112] |
| X-Clientproxiedby | CY1PR18CA0039.namprd18.prod.outlook.com (10.163.31.49) To AT5PR84MB0306.NAMPRD84.PROD.OUTLOOK.COM (10.162.138.28) |
| X-Ms-Office365-Filtering-Correlation-ID | c5bb1ffa-8c86-471b-0b45-08d3843b8463 |
| X-Microsoft-Exchange-Diagnostics | 1;AT5PR84MB0306;2:NSnFa1K1BFBDWdvUGfP6ECcLUrLvLJ4SouePKMypPDNlnIxNpa2pGn63fBWRqHWFYxdpEH0lhN74Uuz3P/Qz6MyP4lKWisFpe3sZULAuZCjA1Vr2RnkvgfsuPLiyVO74CtUgd3lDsgCn174pGxPmRBcQO6CJ+1cMv0tEHjaUfpvX0rVKZJNsTsLVLBRCMm93;3:djLyKiRjiSCbBoFXPcxGVka6ZkLvgNVIs5iS2/dLP+8jPkyghmrQQcG/LtBxmLn9/uvE+JvIHbJshuZz5vvuEhXtXK3PRh5QPAi+SN59Wqi8O/Th7HziA710YD5a6ZJ5;25:SSCvk/yJ4UwQHH22FUARuOIETTM7eajqg/aDiV87WNGNEzPuSRvZF3J2J6LvcgQvTMdNzib5SfWXHlTmZfMC9OjcOaD+ryeUNQ3usDUpPvq11t78kfTB8kjTv/tkNbPGA6TNqH4mPDwMVfkb9x1U0cv0upJUoNeE1PuOCbjb6kQ3fZN94Sk/OO1EnMs3h+Sm+s0/HftCHoy1obyhQfg08jQKYBEO5Z7JoFUeILPpCOx9CtV+CJUsn37YKaHwx0F2aItHYuZizHQq3CNFrfkYz3LlWRKSWNBLtmfEXUblhE5bDMHMh0OntQuE8Gv4KJgEtZna4W8NthrN006KS2WBXagHqAqYDdUzteqvSHasoqgch8g+JFLMJsjm2cNmJ5u4XrRJioDQVI6C8OLJRPsbGSUdpWjFAP+H2kf0vgmBfXw= |
| X-Microsoft-Antispam | UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AT5PR84MB0306; |
| X-Ld-Processed | 105b2061-b669-4b31-92ac-24d304d195dc,ExtAddr |
| X-Microsoft-Exchange-Diagnostics | 1;AT5PR84MB0306;20:2aXlPxEPG8o3uwt8DRtabhJxVlSJVNrX3Qs9n4LJLP1CNAeYIw5oFmKWTYRVUZ3XpE+02kuPs3qd85GVJfO+rr6Khr2idOPREJoOnD0YD/lN/B8v0lEkP6uqGhMw7C6G++715gUXQHPvrhNAmLhNGyPwGZ7mYrYGV9epFbN+xeED2+lRHS661KDaAHN1mfgBI/KGBG8RC5z3lpIVtLNDO2bKLhZXktz08eFRiDZ3avVyPAW8ZznlpaB9o45vPhBCqm0lU5OBIisU2duSGlhirfwHiWn8uahNARmBNmgimiROgurrTDWN3MxJGfZ1ShrgCEIs0oN8dLB4jq9xuqzOZQ==;4:GfbPxeZ7adNsucBQ49xYA3yS08wq3vtSu6fohDFbVQmgac/iAG9WB7+LhsByBB/ouZw7K8TVfp+LJPMqemiruezLInAR4tigm0hZIaoYHgD34KxWUwFY0xBwuaCkyQ9FsVF3jvc0CqsV66RbwHkVL1j5RiKnJhw+j1iq4VEm8aGDSUs+mgWZbdDF5kmui0uNRwRGzJ81H1e6K2UWlE0HqRdbZ1E3Iju6KWNtViZ5ReJx28xW3Qu+2p5Byx8e0IIA3VCuR1pk2jXpgETHyMOujYdFIFMDHYfbpYv9AGpg7S7nf5zFfOWaiokZwixSqNGNonDzB9CP9wjr3VVIiNzXMNEZ2sSEyFfWWYGu2utZ/E+O9i9ZtiNlDK/xwXcEVpuu |
| X-Microsoft-Antispam-Prvs | <AT5PR84MB0306FF3A9857DDBFA1585077F1400@AT5PR84MB0306.NAMPRD84.PROD.OUTLOOK.COM> |
| X-Exchange-Antispam-Report-Test | UriScan:; |
| X-Exchange-Antispam-Report-Cfa-Test | BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:AT5PR84MB0306;BCL:0;PCL:0;RULEID:;SRVR:AT5PR84MB0306; |
| X-Forefront-Prvs | 09538D3531 |
| X-Forefront-Antispam-Report | SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(377454003)(377424004)(24454002)(64126003)(50986999)(54356999)(76176999)(81166006)(4001350100001)(2906002)(2950100001)(4326007)(230700001)(65816999)(586003)(189998001)(36756003)(42186005)(86362001)(33656002)(6116002)(92566002)(3846002)(23676002)(93886004)(110136002)(5004730100002)(77096005)(47776003)(50466002)(5008740100001)(117156001)(66066001)(65956001)(65806001)(8676002)(8666003)(83506001)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:AT5PR84MB0306;H:[192.168.142.138];FPR:;SPF:None;MLV:sfv;LANG:en; |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mqBJxCgzcxiXc2yopOZy5qozET9kjJXhevsgvS/S5J/52BxiOAzjlMy6ki2MgcYV19c8ELkVPIXDnyRA== |
| X-Microsoft-Exchange-Diagnostics | 1;AT5PR84MB0306;5:DZ5f7bsL8CBCqEo6slUiObY+qK0Qk1xiNejfr8vx89iP7t/MvbWFZrNkE0mCI8PEn/8Q6ELt8njMA3BfpB76G/TIMwtRC9DxAyAV4IZ5FWDxG4dsPvPDk5Kqys3yvoea9BqfVkmk3YfReCSZYaIwDQ==;24:HHgVg7qIfsaeHG92lSs0s2QyOFNyYL9g/86MyzhhSG8pPkkejbH2SgXiJtXFIF94osqbZcJf8qfz06tOFkQBdqC3ZUfI2I8enVUCt2WYd8w=;7:jaU6aHPYvY9V3U50jVwP6iNg0Wdi7y3sxEdH7U/4x8TZi6At+Jg3h0bZ434iW9Hc3UIVjT8I7VvuOBmjQoXrQ/jp1jX+EvDo7ieBPoe2JLOvSdwSt49Wc7aREsiEb8Ps1ZJ+GEMzpZPn6dcu/AxGAq/kUDsSZYPwxx+LA3hDKCBomFz2VmpjZ2w2dRP97jMx |
| Spamdiagnosticoutput | 1:23 |
| Spamdiagnosticmetadata | NSPM |
| X-Originatororg | hpe.com |
| X-Ms-Exchange-Crosstenant-Originalarrivaltime | 25 May 2016 01:25:53.1401 (UTC) |
| X-Ms-Exchange-Crosstenant-Fromentityheader | Hosted |
| X-Ms-Exchange-Transport-Crosstenantheadersstamped | AT5PR84MB0306 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 35 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Peter Hurley <peter@hurleysoftware.com>, <jason.low2@hp.com>, Davidlohr Bueso <dave@stgolabs.net>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, <linux-kernel@vger.kernel.org>, Dave Chinner <david@fromorbit.com>, "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>, Scott J Norton <scott.norton@hpe.com>, Douglas Hatch <doug.hatch@hpe.com> |
| X-Original-Date | Tue, 24 May 2016 21:25:46 -0400 |
| X-Original-Message-ID | <5744FF1A.8050804@hpe.com> |
| X-Original-References | <1463534783-38814-1-git-send-email-Waiman.Long@hpe.com> <1463534783-38814-3-git-send-email-Waiman.Long@hpe.com> <20160518140436.GA6273@linux-uzut.site> <1463592095.3369.10.camel@j-VirtualBox> <573CB496.4010707@hpe.com> <1463601515.2587.24.camel@j-VirtualBox> <574086FE.6080807@hurleysoftware.com> <1464029181.2479.21.camel@j-VirtualBox> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1406556 |
Show key headers only | View raw
On 05/23/2016 02:46 PM, Jason Low wrote: > On Sat, 2016-05-21 at 09:04 -0700, Peter Hurley wrote: >> On 05/18/2016 12:58 PM, Jason Low wrote: >>> It should be fine to use the standard READ_ONCE here, even if it's just >>> for documentation, as it's probably not going to cost anything in >>> practice. It would be better to avoid adding any special macros for this >>> which may just add more complexity. >> See, I don't understand this line of reasoning at all. >> >> I read this as "it's ok to be non-optimal here where were spinning CPU >> time but not ok to be non-optimal generally elsewhere where it's >> way less important like at init time". > So I think there is a difference between using it during init time and > using it here where we're spinning. During init time, initializing the > owner field locklessly is normal. No other thread should be concurrently > be writing to the field, since the structure is just getting > initialized, so there are no surprises there. > > Our access of the owner field in this function is special in that we're > using a bit of "lockless magic" to read and write to a field that gets > concurrently accessed without any serialization. Since we're not taking > the wait_lock in a scenario where we'd normally would take a lock, it > would be good to have this documented. > >> And by the way, it's not just "here" but _everywhere_. >> What about reading ->on_cpu locklessly? > Sure, we could also use READ_ONCE when reading ->on_cpu :) > As on_cpu is just a boolean, load tearing isn't really a problem. You either see the bit 0 set or not, but not something in between (not a qbit) :-) Cheers, Longman
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE() Waiman Long <Waiman.Long@hpe.com> - 2016-05-18 03:30 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE() Davidlohr Bueso <dave@stgolabs.net> - 2016-05-18 16:10 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE() Jason Low <jason.low2@hpe.com> - 2016-05-18 19:30 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Jason Low <jason.low2@hpe.com> - 2016-05-18 19:30 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Jason Low <jason.low2@hpe.com> - 2016-05-18 22:00 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Jason Low <jason.low2@hpe.com> - 2016-05-20 00:40 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Peter Hurley <peter@hurleysoftware.com> - 2016-05-21 18:10 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Peter Zijlstra <peterz@infradead.org> - 2016-05-22 12:50 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Jason Low <jason.low2@hpe.com> - 2016-05-23 20:50 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Davidlohr Bueso <dave@stgolabs.net> - 2016-05-23 21:50 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-05-23 22:20 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Davidlohr Bueso <dave@stgolabs.net> - 2016-05-23 23:10 +0200
Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE Waiman Long <waiman.long@hpe.com> - 2016-05-25 03:30 +0200
csiph-web