From patchwork Wed Nov 4 15:39:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 7551611 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CAC17BEEA4 for ; Wed, 4 Nov 2015 15:39:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0E8E204A0 for ; Wed, 4 Nov 2015 15:39:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4A2E202D1 for ; Wed, 4 Nov 2015 15:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030642AbbKDPjR (ORCPT ); Wed, 4 Nov 2015 10:39:17 -0500 Received: from foss.arm.com ([217.140.101.70]:32799 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030465AbbKDPjP (ORCPT ); Wed, 4 Nov 2015 10:39:15 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 312D64A; Wed, 4 Nov 2015 07:39:05 -0800 (PST) Received: from e104818-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6CEDB3F21A; Wed, 4 Nov 2015 07:39:13 -0800 (PST) Date: Wed, 4 Nov 2015 15:39:10 +0000 From: Catalin Marinas To: Christoph Lameter Cc: Robert Richter , Joonsoo Kim , Linux-sh list , Will Deacon , "linux-kernel@vger.kernel.org" , Robert Richter , linux-mm@kvack.org, Tirumalesh Chalamarla , Geert Uytterhoeven , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH] arm64: Increase the max granular size Message-ID: <20151104153910.GN7637@e104818-lin.cambridge.arm.com> References: <20151103120504.GF7637@e104818-lin.cambridge.arm.com> <20151103143858.GI7637@e104818-lin.cambridge.arm.com> <20151103185050.GJ7637@e104818-lin.cambridge.arm.com> <20151104123640.GK7637@e104818-lin.cambridge.arm.com> <20151104145445.GL7637@e104818-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Nov 04, 2015 at 09:28:34AM -0600, Christoph Lameter wrote: > On Wed, 4 Nov 2015, Catalin Marinas wrote: > > > BTW, assuming L1_CACHE_BYTES is 512 (I don't ever see this happening but > > just in theory), we potentially have the same issue. What would save us > > is that INDEX_NODE would match the first "kmalloc-512" cache, so we have > > it pre-populated. > > Ok maybe add some BUILD_BUG_ONs to ensure that builds fail until we have > addressed that. A BUILD_BUG_ON should be fine. Thinking some more, I think if KMALLOC_MIN_SIZE is 128, there is no gain with off-slab management since the freelist allocation would still be 128 bytes. An alternative to reverting while still having a little benefit of off-slab for 256 bytes objects (rather than 512 as we would get with the revert): Whichever you prefer. diff --git a/mm/slab.c b/mm/slab.c index 4fcc5dd8d5a6..ac32b4a0f2ec 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2212,8 +2212,8 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) * it too early on. Always use on-slab management when * SLAB_NOLEAKTRACE to avoid recursive calls into kmemleak) */ - if ((size >= (PAGE_SIZE >> 5)) && !slab_early_init && - !(flags & SLAB_NOLEAKTRACE)) + if ((size >= (PAGE_SIZE >> 5)) && (size > KMALLOC_MIN_SIZE) && + !slab_early_init && !(flags & SLAB_NOLEAKTRACE)) /* * Size is large, assume best to place the slab management obj * off-slab (should allow better packing of objs).