Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758551AbcLPVYK (ORCPT ); Fri, 16 Dec 2016 16:24:10 -0500 Received: from mail-bl2nam02on0099.outbound.protection.outlook.com ([104.47.38.99]:16702 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755886AbcLPVYC (ORCPT ); Fri, 16 Dec 2016 16:24:02 -0500 From: Matthew Wilcox To: Rasmus Villemoes CC: Tejun Heo , "linux-kernel@vger.kernel.org" , Lai Jiangshan , "Jens Axboe" , Greg Kroah-Hartman , "linux-block@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Andrew Morton" 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++nkCQM7WotKEKtg/QgABcHJ+AAAiNEA== Date: Fri, 16 Dec 2016 21:09:07 +0000 Message-ID: References: <1481160187-9652-1-git-send-email-linux@rasmusvillemoes.dk> <20161209140140.5e0a68e2e1cf9861335bdf3b@linux-foundation.org> <87inqj8vjo.fsf@rasmusvillemoes.dk> In-Reply-To: <87inqj8vjo.fsf@rasmusvillemoes.dk> 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.244.59] x-ms-office365-filtering-correlation-id: 81bdff5d-9b30-45c1-2a73-08d425f7c5ef x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BY2PR21MB0033; x-microsoft-exchange-diagnostics: 1;BY2PR21MB0033;7:5nnrSXFGATpdC0Ii/CGhdil/SGMtl3sGDs3Bxihj//OwkEkAXtlzLUTEHWtJh/ynnKCgmqoA2c3d2WpCGcpsxOCVazo/D+MH/T/Fqitjl7saO1uVOORakoFtugLf81grUAroz6Nx0czLTogsIVv26wST3Roh0JragqtGdZDHfF1a81vXWQwgZRdTbsmRpddUv67DsWAFiVhTyqI8cC1VeDjS/LwoLvaIwduIwBZwzuoCrw7nqOVwNwY3V7ORzOudkTxZvF2pd14WoksP8iMsiIQkiehxMr1uFV3Om94JRN68tbaO8ySxVhSPQVIBOHrtfgV/DsyLQh7nfQAlv6mj2KlgI3B9UpgswRdJdLgM6Lu/QbXF1B3pWIBUqq+ti185vDrrueRaT6ZZMYlZtf5pkvIiRZLCNG5E7i0ISKF+EceCgBC21/R+u3lnarz9cZW7VKnULIT3sdGcJVQdpY+IkpHeYXOoEib6wTwUiw+zyCI= 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)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148);SRVR:BY2PR21MB0033;BCL:0;PCL:0;RULEID:;SRVR:BY2PR21MB0033; x-forefront-prvs: 01583E185C x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(39450400003)(39860400002)(39850400002)(39410400002)(39840400002)(189002)(199003)(24454002)(6916009)(101416001)(5005710100001)(6116002)(110136003)(10290500002)(97736004)(7696004)(68736007)(122556002)(189998001)(2950100002)(9686002)(8990500004)(7736002)(74316002)(4326007)(76576001)(305945005)(102836003)(3846002)(6436002)(25786008)(2906002)(6506006)(106356001)(105586002)(229853002)(81156014)(10090500001)(106116001)(39060400001)(81166006)(86362001)(8676002)(77096006)(50986999)(76176999)(99286002)(8936002)(33656002)(54356999)(86612001)(38730400001)(66066001)(3660700001)(3280700002)(5660300001)(2900100001)(92566002)(93886004);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR21MB0033;H:BY2PR21MB0036.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A: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: 16 Dec 2016 21:09:07.2576 (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 uBGLOEKk029353 Content-Length: 2437 Lines: 38 From: Rasmus Villemoes [mailto:linux@rasmusvillemoes.dk] > On Fri, Dec 16 2016, Matthew Wilcox wrote: > > Thanks for your work on this; you've really put some effort into > > proving your work has value. My motivation was purely aesthetic, but > > you've got some genuine savings here (admittedly it's about a quarter > > of a cent's worth of memory with DRAM selling for $10/GB). > > Nevertheless, that adds up over a billion devices, and there are still > > people trying to fit Linux into 4MB embedded devices. > > > > Yeah, my main motivation was embedded devices which don't have the > luxury of measuring their RAM in GB. E.g., it's crazy that the > watchdog_ida effectively use more memory than the .text of the watchdog > subsystem, and similarly for the kthread workers, etc., etc.. I didn't > mean for my patches to go in as is, more to provoke some discussion. I > wasn't aware of your reimplementation, but it seems that may make the > problem go away. It certainly shrinks the problem down to a size where it may not be worth introducing another implementation. > > On a 64-bit machine, your tIDA root is 24 bytes; my new IDA root is 16 > > bytes. If you allocate only one entry, you'll allocate 8 bytes. > > Thanks to the slab allocator, that gets rounded up to 32 bytes. I > > allocate the full 128 byte leaf, but I store the pointer to it in the > > root (unlike the IDR, the radix tree doesn't need to allocate a layer > > for a single entry). So tIDA wins on memory consumption between 1 and > > 511 IDs, and newIDA is slightly ahead between 512 and 1023 IDs. > > This sounds good. I think there may still be a lot of users that never > allocate more than a handful of IDAs, making a 128 byte allocation still > somewhat excessive. One thing I considered was (exactly as it's done for > file descriptor tables) to embed a single word in the struct ida and > use that initially; I haven't looked closely at newIDA, so I don't know > how easy that would be or if its worth the complexity. Heh, I was thinking about that too. The radix tree supports "exceptional entries" which have the bottom bit set. On a 64-bit machine, we could use 62 of the bits in the radix tree root to store the ID bitmap. I'm a little wary of the potential complexity, but we should try it out. Did you come up with any fun tests that could be added to the test-suite? It feels a little slender right now.