Received: by 10.192.165.156 with SMTP id m28csp241129imm; Tue, 17 Apr 2018 09:21:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx484SyDfdqcUhaavBhK9COqgy3DFdtHrXmC8tlVZZCK7pIBjm1jkexe4gUN+rWL+yLUZwfme X-Received: by 10.99.0.213 with SMTP id 204mr2323113pga.256.1523982082431; Tue, 17 Apr 2018 09:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523982082; cv=none; d=google.com; s=arc-20160816; b=g+TUnE9m/FzzU15yvgyKKL0P1rJUv7l+0jzUd43jtVBWzkApwaHbJ0uQkjSvQzixuH ncD+W+DTen+NoigpYEwqh+M0twx6rydykHsUOlG4cI/dN9GXV0hLcjhrxdDUSAeUGGJn HbEuC29FKvyj4sLuGaQGdZjUNDEmO/AsLSNIDUn2tKrk7BXtDQSTmCA9ZjXNr3COrMVe aiI/bZXXNlon3ZbIpedT68fUxkW8+NiOCczopv0w7bLzKYLgor3O4xj7Lvpzt4mrpUD+ etL3UL7QUQG9eD/jw1gJLzup9vgkRmeF9itCdfBUsHAxkkOPSFnjRPvGy14wcytfK/Jc IwyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=tCpusNEr45y+83VBaCvIy+yMaZrqmmhE71QwpVn/Bew=; b=n4OkqKFAxNdfiPZ63P476PMkWL6egRQc+cmbVd9kjNhzDUn6Hv9mZwxlr3Xvb9Aclc BFd6oFf42coYoSlcKHGNaMGHn7rY+CMWhpc2ZVqlDOru0S1Rab0E1+J/WDpX+HE/YXI6 sCW+aFU8m5k5HaZbYn4JXsr9zfz9U5yL6A1DI2Ue84Nfez+88oL0d+mUZEsJhYJtkkxZ JpQH+V2KCugvauNWBLrV/Q1S//nD9EPjVo2CRjF+/lPFkl8IG2h4TO+32Trz0kYVC2yu CvVWA0BW3sIevFxXCnTz7NFLhX2EiUDzdr6TdH69Qa6xYIegKkpy+43n2U9pR8Er1Ug5 90sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si11681358pgp.298.2018.04.17.09.21.08; Tue, 17 Apr 2018 09:21:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755996AbeDQQSP (ORCPT + 99 others); Tue, 17 Apr 2018 12:18:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:38245 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755929AbeDQQSN (ORCPT ); Tue, 17 Apr 2018 12:18:13 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CE259AE28; Tue, 17 Apr 2018 16:18:11 +0000 (UTC) Subject: Re: [PATCH RESEND] slab: introduce the flag SLAB_MINIMIZE_WASTE To: Christopher Lameter , Mikulas Patocka Cc: Mike Snitzer , Matthew Wilcox , Pekka Enberg , linux-mm@kvack.org, dm-devel@redhat.com, David Rientjes , Joonsoo Kim , Andrew Morton , linux-kernel@vger.kernel.org References: <20c58a03-90a8-7e75-5fc7-856facfb6c8a@suse.cz> <20180413151019.GA5660@redhat.com> <20180416142703.GA22422@redhat.com> <20180416144638.GA22484@redhat.com> From: Vlastimil Babka Message-ID: Date: Tue, 17 Apr 2018 18:16:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/17/2018 04:45 PM, Christopher Lameter wrote: > On Mon, 16 Apr 2018, Mikulas Patocka wrote: > >> This patch introduces a flag SLAB_MINIMIZE_WASTE for slab and slub. This >> flag causes allocation of larger slab caches in order to minimize wasted >> space. >> >> This is needed because we want to use dm-bufio for deduplication index and >> there are existing installations with non-power-of-two block sizes (such >> as 640KB). The performance of the whole solution depends on efficient >> memory use, so we must waste as little memory as possible. > > Hmmm. Can we come up with a generic solution instead? Yes please. > This may mean relaxing the enforcement of the allocation max order a bit > so that we can get dense allocation through higher order allocs. > > But then higher order allocs are generally seen as problematic. I think in this case they are better than wasting/fragmenting 384kB for 640kB object. > Note that SLUB will fall back to smallest order already if a failure > occurs so increasing slub_max_order may not be that much of an issue. > > Maybe drop the max order limit completely and use MAX_ORDER instead? For packing, sure. For performance, please no (i.e. don't try to allocate MAX_ORDER for each and every cache). > That > means that callers need to be able to tolerate failures. Is it any different from now? I suppose there would still be smallest-order fallback involved in sl*b itself? And if your allocation is so large it can fail even with the fallback (i.e. >= costly order), you need to tolerate failures anyway? One corner case I see is if there is anyone who would rather use their own fallback instead of the space-wasting smallest-order fallback. Maybe we could map some GFP flag to indicate that. >