Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754168AbcLLRfV (ORCPT ); Mon, 12 Dec 2016 12:35:21 -0500 Received: from mail-sn1nam02on0125.outbound.protection.outlook.com ([104.47.36.125]:45034 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752544AbcLLRfU (ORCPT ); Mon, 12 Dec 2016 12:35:20 -0500 From: Matthew Wilcox To: Tejun Heo , Andrew Morton CC: Rasmus Villemoes , "linux-kernel@vger.kernel.org" , Lai Jiangshan , Jens Axboe , Greg Kroah-Hartman , "linux-block@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "kent.overstreet@gmail.com" Subject: RE: [RFC 00/10] implement alternative and much simpler id allocator Thread-Topic: [RFC 00/10] implement alternative and much simpler id allocator Thread-Index: AQHSUme+SjIWPmjllE++nkCQM7WotKEEkFOAgAAAv/A= Date: Mon, 12 Dec 2016 17:35:17 +0000 Message-ID: References: <1481160187-9652-1-git-send-email-linux@rasmusvillemoes.dk> <20161209140140.5e0a68e2e1cf9861335bdf3b@linux-foundation.org> <20161212170959.GB13864@htj.duckdns.org> In-Reply-To: <20161212170959.GB13864@htj.duckdns.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=mawilcox@microsoft.com; x-originating-ip: [104.247.230.140] x-ms-office365-filtering-correlation-id: e75e0f53-89a9-4f96-3336-08d422b53d81 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BY2PR21MB0033; x-microsoft-exchange-diagnostics: 1;BY2PR21MB0033;7:/jG88KV6uNZU3mHNWFlv55ob7+gTY+HNnufu2bF91ynSAS1fzPdhxARbBFXFTosxKBLl2CM4oQqpIbBP4T1hyZA51CVuJW8wftdWiAZYpVyuEWWI6Qw2wnVrmr94RdDNi8dcdWOQeR2ckuyASza8BW3pmqWm/DxLmS0tZd695WFB1sHo3V+a8Lz/Uli9mK5Z1jLQntdUDWg3Danbc7QfylXh0pcFWLb03g1G9yZMh7uPrXgOhYYNzF168KahcQHgsvlDi/wYHAwdel9rTVKA/DKkzTqN5MnO+Baul63SDdLvSmEuQJmT+ea2BQ8wYpi2yGpa0E6fNuak5EPVaFiUWCYhauG7z0L77PV0m/qJeWnnXmC1WgzYTMBGXc0jma7kyvZFC05aoy06JsujBpEXeNE4GMjfVqy5dfLlP8VGxkwB96YVhacNcMdOBQN+A5YjOI74/RsjGz6aZNYIT/wyyi8u9qqf0fGSvSz8n9oPq8Y= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148);SRVR:BY2PR21MB0033;BCL:0;PCL:0;RULEID:;SRVR:BY2PR21MB0033; x-forefront-prvs: 0154C61618 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(39860400002)(39410400002)(39450400003)(39840400002)(39850400002)(199003)(189002)(101416001)(2950100002)(4326007)(5005710100001)(77096006)(105586002)(39060400001)(6506006)(9686002)(229853002)(66066001)(6436002)(86612001)(86362001)(38730400001)(106356001)(8676002)(2900100001)(10290500002)(5001770100001)(81156014)(50986999)(106116001)(99286002)(92566002)(33656002)(97736004)(5660300001)(189998001)(76576001)(122556002)(7416002)(305945005)(7696004)(81166006)(68736007)(102836003)(8990500004)(54356999)(76176999)(8936002)(6116002)(3846002)(10090500001)(74316002)(2906002)(7736002)(3280700002)(3660700001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR21MB0033;H:BY2PR21MB0036.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2016 17:35:17.8902 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR21MB0033 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id uBCHZVk2006306 Content-Length: 1305 Lines: 18 From: Tejun Heo [mailto:htejun@gmail.com] On Behalf Of Tejun Heo > Ah, yeah, great to see the silly implementation being replaced the > radix tree. ida_pre_get() looks suspicious tho. idr_preload() > immedicately being followed by idr_preload_end() probably is broken. > Maybe what we need is moving ida to idr like preload interface and > then convert it to radix based interface? ida currently assumes > per-ida preloading. Hey Tejun! Great to have your comments on this reimplementation. I know the preload followed by preload_end looks wrong. I don't think it's broken though. If we get preempted, then the worst situation is that we'll end up with the memory we preallocated being allocated to somebody else. Then the attempt to allocate memory can fail, and we'll return -EAGAIN, at which point all callers are supposed to return to the pre_get() stage. Certainly that's what ida_simple_get() does. Hmm ... looking at the implementation again, we might return -ENOMEM when we should return -EAGAIN. Let me fix that (and the test suite ...) I'd definitely be open to changing the IDA API. I know Kent had some thoughts on that including splitting the simple lock into a per-IDA lock. His last work on it was here, I believe: https://evilpiepirate.org/git/linux-bcache.git/log/?h=idr