Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754428AbbK3SR1 (ORCPT ); Mon, 30 Nov 2015 13:17:27 -0500 Received: from mail-am1on0073.outbound.protection.outlook.com ([157.56.112.73]:4576 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751484AbbK3SRX (ORCPT ); Mon, 30 Nov 2015 13:17:23 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf@ezchip.com; From: Chris Metcalf Subject: Re: [PATCH 1/7] atomic: Export fetch_or() To: Frederic Weisbecker References: <1447424529-13671-1-git-send-email-fweisbec@gmail.com> <1447424529-13671-2-git-send-email-fweisbec@gmail.com> <56548908.50509@ezchip.com> <20151124211951.GA16609@lerouge> <5654DB33.1080706@ezchip.com> <20151130173619.GA9444@lerouge> CC: LKML , Peter Zijlstra , Thomas Gleixner , Luiz Capitulino , Christoph Lameter , Ingo Molnar , Viresh Kumar , Rik van Riel Message-ID: <565C92AA.4060109@ezchip.com> Date: Mon, 30 Nov 2015 13:17:14 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151130173619.GA9444@lerouge> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [173.76.21.154] X-ClientProxiedBy: CY1PR21CA0091.namprd21.prod.outlook.com (25.164.213.17) To DB3PR02MB123.eurprd02.prod.outlook.com (10.141.3.21) X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB123;2:29Y4Ic6rh70C+l+VYglu1X3h3/K29zM69dRM/HHkVoFFCtFtxt0s2EWom/Knu7AHA/rA9315e3ZWa5664lL4Ar5rqIbDN6D1C9MKP4iFYLgG0nbM3YOc2ihJil6uW4v4hPUVf1xDmThb1rwe7XX3Mg==;3:h6+nrATPh+0CWV0+mS4mUUlZ5wKoBsiq2PMewYBp4Ja/ze4z8/aRU/X8AbEyT1oTsFCq/bJjOqBbldp2aJldvzBzkGCPnKb7z/qNYouCmnTqsJ+ipm5bpwGf5L5pauiM;25:DmWZQiTmIZL79CZgfWg3Y7RG/rT4gombnE3kTTyrP1/qVSaf2zM2FfQeRMKagK2pgyMN718spmI+6uUdT4Iz8leJhwzeUFrzTuTJhGy3NjvxOLVdgW/EEdzlkCiqOvQCtmV9CC0wNxIfX9RkNZVi514yTSW8t7UNSJItI9RJS3lpoyTzvG0la1Jcwu/GUQZWiFLyIEBSFTIK5i5Dw8C1X4kb9vAnccCELJCPDFDwGz2ygH92aVbvHodJ1hbIUOxk;20:N+u79xXrNAhX6FtLmFVtDIHn229LX9btSg40WvPvgpj1pMxxjd7ZFnRPwaWokQVrDs1Z2mDy2KR3/1kwssiPeuSC34pqfYxylXrheCmcGMqU8dk0caixCt3mf31Za773AJFawmroHpDYbB1IfDEU7CIgyrLYgrFonsxlOsfsUNQ= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB123; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001);SRVR:DB3PR02MB123;BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB123; X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB123;4:nbQ4amX48iLJonvy/1GbCAMFKWo5PGy1WKLEOOzjKPBgLnSFpDOZP39r/kWOtdvPbK8iWfgg/x8Tc5nAKUNIfVUIFTXAvI2dTL+rx2eRBsdsP94rX1GcSIBNLE7lUmSc7ibVnrJu6QS8PDxsf0KiIpZu1+eAkx/mKjuPDhmqWQQemUgY6Lh8EIEmqLNuhGelfSH+nF4z9QVvk2Fr1GPEKLNLHr/UH0LEfqLZ9v6BMqA44SjX7b4e69X20b/yfD+Ypw/HHhuUJjfIQbUyhh+2D0+3AWZ7opAkRECSNo5FozLzAwGB+YJ5C1SsbUyON+dvjrAMgPSjxGm4faVOg+DTthJIlPwmffQw8aaMW+ogdcBLT7rlUcR142/B7oYJvC6LvK9b4gcUOilvHn1DE5eIfB21sZo5UQ8p+qw47LU+TII= X-Forefront-PRVS: 0776C39A48 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(6009001)(189002)(377454003)(479174004)(199003)(24454002)(50986999)(23746002)(6116002)(15975445007)(40100003)(64126003)(54356999)(4001350100001)(106356001)(97736004)(76176999)(87266999)(65816999)(65806001)(1096002)(65956001)(83506001)(66066001)(1411001)(77096005)(189998001)(105586002)(47776003)(50466002)(2950100001)(87976001)(36756003)(3846002)(5004730100002)(93886004)(110136002)(122386002)(81156007)(5008740100001)(80316001)(92566002)(230700001)(101416001)(42186005)(5001960100002)(117156001)(19580395003)(33656002)(86362001)(586003)(59896002)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB3PR02MB123;H:[192.168.1.165];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB3PR02MB123;23:k8/guxOMGo8iipfH19isrhuGZdMZQ8bG4bFY4+?= =?Windows-1252?Q?r742R+Vf7Zd7o6GyEaLk+veWF4o7OdxHKcjvabKcoxAjG64YXur2zKOD?= =?Windows-1252?Q?1OnUvOLOsG03QjY4P4jV5vVKnrQuseIq/IRDw4uei4ZPfkNpXaNpRgHV?= =?Windows-1252?Q?PnyB9vIJX3L5l62W4RHTHfS+pWAQyALCQFpwz3wD3Xoq/HqQHbQnCZ8D?= =?Windows-1252?Q?sakzgtkg2S9b3QSYa7q/oEDViK4rbFJQKWX6leXnaTQR3LDhCmmns/8p?= =?Windows-1252?Q?xvTTJ3ntDwm7ZUmjvDxj6wRZugIjBnRzRFOt0q2+VsdfomnpMxoL8ANd?= =?Windows-1252?Q?MXLD4MiftthPhMq3qmKrTiGkiDLgYrR6WnOyGqD7oX5+aCwb8SUorMnd?= =?Windows-1252?Q?Olv5XGqjuhBCQiVOgIf76wtMXFHEqausptHmgFpFG/RbgTA3g8jLje7y?= =?Windows-1252?Q?Xxy3smTBGGd0KVpWkBG+/I3Whu1QnOS0Kss8R8BNpVAAvXrL2ae3xQQr?= =?Windows-1252?Q?gDO/b8c+6ZCbWEzuC83Vy2No/HPhhOD1VdfA2+l+yL4jbRHI059SwZ7+?= =?Windows-1252?Q?0vk3lMwHKoQpPr4YHqzV81lkLtQ11lMsjdMpl7ByqE9M+cqPAfM0w/+u?= =?Windows-1252?Q?2TC3gCbRCFvYOS+JL9gE42gUcOqq+b/bP8UKEQ97f+sXo0yobINguGr5?= =?Windows-1252?Q?fD0WmMGkl5ZHQyr0HOrYsWs/TlLKg+S+e+XSRUQEh3PIdQTvTDsMntTF?= =?Windows-1252?Q?akABGivOSUBzBJaM8HKJZUXFA7Fh1BL4U6SJOAU7PeqUtIAsIvDGWzRN?= =?Windows-1252?Q?VWaJPdmnQlJkqIbfRmj0RJ+OmoV3dPnlJxkBtdW08VTs1mMTQPcLZF32?= =?Windows-1252?Q?4jVxLJWyM5LJsNnhivKOSgrgku/2S6XHRAfuk4oKDxTe5LZTfkKxx1cZ?= =?Windows-1252?Q?ILe9B5pSVWE/kTegDAjBBtdIssNLx2XFzoA8h8bnr6hJqeB5uGxvqJ+o?= =?Windows-1252?Q?C/jSscrpVmDPp3znXNOQLIHaTxK+H/CHE1tomJSNzoO/BYuFK5Xnq1Fi?= =?Windows-1252?Q?JNWBPNJHo/gHMZfV1Fo0aCUjftCBxJvbJH8jUjrwvYz1eTzrZa0G4rMc?= =?Windows-1252?Q?O42L54HNQ4go6d6pwCvRUjAFOYr+oBq6Di6oD3IVXFHCuDsRNNOoXM34?= =?Windows-1252?Q?hSUlBKk9V/UbEa6QVD+yClJ5zSQ1QqmOzdGmfpUfRnkDUNu4kn2X3xM8?= =?Windows-1252?Q?TzeaFf8jxXYdnpZ4zx/nC3/ID4NhJRv+hnsw2B23TPzYc3Ls9LUQ8X9J?= =?Windows-1252?Q?i/VH62TfdHE2tGksJQc74D6nvTvzJv4ukbbvI+FJPlW1x/CX6zoArdV/?= =?Windows-1252?Q?Xz/KWGt8I7W7VKcrkAr8wIAO1wNfPZFieFSzu91gCuNxgXDOdC97V16P?= =?Windows-1252?Q?FJpFX7ROq184XjlPDQ9A++0piqkgTrivuFNYMbgMlLjnoU2jy097dnII?= =?Windows-1252?Q?4XI/U=3D?= X-Microsoft-Exchange-Diagnostics: 1;DB3PR02MB123;5:VEDhathA7aD8GbZ4TuuUFuEtZqgFAElx33bMReANB4+Ygj7FfZL2v3I7p/C5itbz35ro7R2L0/S+7rKHociCThMFt1/av+tT7DZZtiV1yNx+760dB/oxQtj7nbscpPW61nhQZdnS91Fj0+NpLhpusA==;24:5Bj0r9XLfaGfNBZ0xxMQz9QYWIGDtMUwNhPrzJ1/6alQVmOz90pF9ZRwhKkxlK7rXguijPKVu2VWb27gN76m42StwCjmyhgDNQQrM1Ytjn8= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2015 18:17:19.2791 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR02MB123 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1646 Lines: 33 (Resending as plain text. Not sure what Thunderbird was smoking to make this message multipart/alternative originally...) On 11/30/2015 12:36 PM, Frederic Weisbecker wrote: > On Tue, Nov 24, 2015 at 04:48:35PM -0500, Chris Metcalf wrote: >> >Unless you want to take a big diversion into atomics, I'd be tempted >> >to leave Peter's macro alone and just write it off as necessary evil >> >to handle the fact that thread_info.flags is all kinds of different sizes >> >and types on different platforms, and definitely never an atomic_t. >> >Instead just create an inline function atomic_return_or(), or >> >whatever name you prefer, that operates on an atomic_t, and use >> >the atomic_t type for your structure field. It's clearly a win to mark >> >the data types as being atomic to the extent we can do so, I think. > I agree that cmpxchg, test_and_set_bit, fetch_or... functions with loose > namespaces aren't the best layout. > > But casting thread_info to atomic_t really worries me, I'm not sure the ending > result would be correct at all. I prefer to sacrify correctness over namespace > sanity:-) Just to clear, I wasn't suggesting that that necessarily was the way for you to go. The last four lines of my message quoted above are what I think might be the best way forward, and don't involve messing with thread_info at all. -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/