Received: by 10.192.165.148 with SMTP id m20csp929542imm; Fri, 27 Apr 2018 09:43:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrX96Ieq9uevc/dgV0UrKJtAfxeNv1EEml1kVvPDba8aZaVf5hvvCC6twGg6xDZuIZ4cwP7 X-Received: by 10.98.68.135 with SMTP id m7mr2821070pfi.57.1524847412782; Fri, 27 Apr 2018 09:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524847412; cv=none; d=google.com; s=arc-20160816; b=DCo/6qIuhhAvhYGWZ90TIn1qvmMl9y0xeXZYW5nbtPVJRhsnOU55Gq7K9/asCvYIjv Eqy0SD2HS1bvYtX478VL/gap5c+L+R/q5aImSrQCG+AlJ9pmc6lz3bYdWJwa83uG6jfo hCIoemxjLY8HB/gVWfLnUJsR1wrAYyjYku8e1/tKaL0DG+/+nhSbRObS5FpUMtRJdDvb 7DqGbyuJvEa0ZZ8M1MrWRCXWLOo9rhLqVath5MbfvE6P8PpBoxJKBcS70yx+VWJhlKP2 bk3IaUIsIbnzVOWHgoiCxGTwTkfy7cBjCMciKXmmMzyknfddMofQHhplkalrYQx7wI4Z vwDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=q467ZC2ViPXq72lPErCNsfWvZBrMJ11hiRtVT7kHlU8=; b=x/8Cvsbeca7N6DTJBGMk3dj7yOtZDzHfgYaAw8q18UEsZofAbIOIseN2rqdNmqXjS+ M+qboBwsoJSUxBC+HaeYZBtNFEVkeF8FVhRtyD7bkrfY0I+3IGEGjpZ0OWA2Zdr36qMp nDDYRBwDtUpqEpVvuDyFlFUSHbHDoZuvV2FmTAXoW/WMY2UmZ4z1S+AT4L10rg0QpDT+ ZZquwGcuM1dh5sQzahbaGE1Kzg0nxUOU7Udr2m8hECpTsNHoPScL+iEdFZ8324CDNfj1 rDtXRElyh7BHoaXJ4Q7uwpU3Y8WahnkTaYHMT+VCSHcsp9NH4OLeQSUeC6EBOewXA10g mR8g== 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 r10-v6si1612217plo.344.2018.04.27.09.43.18; Fri, 27 Apr 2018 09:43:32 -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 S1758710AbeD0Qlv (ORCPT + 99 others); Fri, 27 Apr 2018 12:41:51 -0400 Received: from resqmta-ch2-11v.sys.comcast.net ([69.252.207.43]:48498 "EHLO resqmta-ch2-11v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757569AbeD0Qlu (ORCPT ); Fri, 27 Apr 2018 12:41:50 -0400 Received: from resomta-ch2-04v.sys.comcast.net ([69.252.207.100]) by resqmta-ch2-11v.sys.comcast.net with ESMTP id C1OhfZU5aqEz4C6RRfKPae; Fri, 27 Apr 2018 16:41:49 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-04v.sys.comcast.net with ESMTPA id C6RQfrU45xo5NC6RQf6BY4; Fri, 27 Apr 2018 16:41:49 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 260BF1161665; Fri, 27 Apr 2018 11:41:48 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 23700116012E; Fri, 27 Apr 2018 11:41:48 -0500 (CDT) Date: Fri, 27 Apr 2018 11:41:48 -0500 (CDT) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Mikulas Patocka cc: Mike Snitzer , Vlastimil Babka , Matthew Wilcox , Pekka Enberg , linux-mm@kvack.org, dm-devel@redhat.com, David Rientjes , Joonsoo Kim , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND] slab: introduce the flag SLAB_MINIMIZE_WASTE In-Reply-To: Message-ID: References: <20c58a03-90a8-7e75-5fc7-856facfb6c8a@suse.cz> <20180413151019.GA5660@redhat.com> <20180416142703.GA22422@redhat.com> <20180416144638.GA22484@redhat.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfKRd0xxBHiYG40oJPrc/urVxdNRBR2q1ftF+CpTOFADAnP3G9v8Fs1bp6ldks2HkwS19ocdQQ21oEBiJ2WA8kn9QlLOHaKCxI4oxhcGJjmSOQeq804PC s1KNGzW3wDaAtFRzWiqgoKcYE3DLSkPwMGVV737LGqYsT+jlmfajXJ/7ULM6KqbDAhciRs9RUvS24SboETlf2HGCJAO6rPXsc5Alu5doY+pPaCm53G3fe440 Xxzeglr8uyElq5RQZm7zOZDRJvcTSsTNUyfH0kHKD/hTl/wN9eVwC16Dppqd8+CImYuapnFqVHEGO5APlpkjwqVgGHHFSXtTKHtWs16hUY8PsUWhNVI2opQt dxXuSDMC5ak3YdwhQOE0C+y3PwOXnxUIwfC5YtlcX7lRcounEkiWKcIp2bew8PBszAL2+HDSlIoI8ryhtZXP4/n2bleGqeldHzG382f2yYR3gp4EhkW9j/G/ g9OBXOXMnkTaYZgY Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 26 Apr 2018, Mikulas Patocka wrote: > > Hmmm... order 4 for these caches may cause some concern. These should stay > > under costly order I think. Otherwise allocations are no longer > > guaranteed. > > You said that slub has fallback to smaller order allocations. Yes it does... > The whole purpose of this "minimize waste" approach is to use higher-order > allocations to use memory more efficiently, so it is just doing its job. > (for these 3 caches, order-4 really wastes less memory than order-3 - on > my system TCPv6 and sighand_cache have size 2112, task_struct 2752). Hmmm... Ok if the others are fine with this as well. I got some pushback there in the past. > We could improve the fallback code, so that if order-4 allocation fails, > it tries order-3 allocation, and then falls back to order-0. But I think > that these failures are rare enough that it is not a problem. I also think that would be too many fallbacks. > > > + /* Increase order even more, but only if it reduces waste */ > > > + if (test_order_obj <= 32 && > > > > Where does the 32 come from? > > It is to avoid extremely high order for extremely small slabs. > > For example, see kmalloc-96. > 10922 96-byte objects would fit into 1MiB > 21845 96-byte objects would fit into 2MiB That is the result of considering absolute byte wastage.. > The algorithm would recognize this one more object that fits into 2MiB > slab as "waste reduction" and increase the order to 2MiB - and we don't > want this. > > So, the general reasoning is - if we have 32 objects in a slab, then it is > already considered that wasted space is reasonably low and we don't want > to increase the order more. > > Currently, kmalloc-96 uses order-0 - that is reasonable (we already have > 42 objects in 4k page, so we don't need to use higher order, even if it > wastes one-less object). The old code uses the concept of a "fraction" to calculate overhead. The code here uses absolute counts of bytes. Fraction looks better to me.