Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp120480iog; Wed, 29 Jun 2022 19:39:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1toIw7vrxqy+EUr0nao4UW3qqa+0bTGNfHGoSkL+2olAklGy5jLxGqVi1dfo5kwEd+xedq6 X-Received: by 2002:a17:906:4f:b0:712:af2:29d9 with SMTP id 15-20020a170906004f00b007120af229d9mr6491953ejg.751.1656556773052; Wed, 29 Jun 2022 19:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656556773; cv=none; d=google.com; s=arc-20160816; b=VC2IA0lAR6LsB8dwntbdiIRsa6Q2ihLMQ3jwt318sIj8fzMrsaDEWaGJ7A7XCoLEfa UAIooG7FLOlOIskoKyQrqMkR8yEvjcozIwWtxCgtag1cCUTPAYgVWpTgi76QsYggc+RX T4u1Hs92tvZwv9d19G17IF4Gh8/1N70lpzFD1KUiRbQTlfGNbhlX3AYbIrDFCKTwh9J/ KCYEaXnqkQqBOceFGA/+JAJVSH67revRQL3p9aHbYuPHODKEW1YvXmFstVwDw9loxn/Y UlMlnzIprWicdnvNZ6raPltcNTj5Np094gEjjppjITdqLcWhx4/r+RXuFkyDyGL7n4aF gopA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8703lMIOkmz7Ir1AX7wX1GGc6PqBlELEAATrKLaVPbI=; b=CuwCEklSUSWeEaGyL1P4M5yVM8YfZTitvjUCltLrbtScfqbk1xxsN/n7jkSAuo0CtG PP/qS1AG9Q7hpWiuofkZd+GY7WPV9miCwR4L7QKRF/iPssK5+KiuQjAGWNKTHJXrDGjl E1CNtp4eDQ7JPVw61VcA7REoKp4meb7tMN1hb0exbkS5adYTUXAYCNOsCJpV7cFrV4aY p85r372XCarn46PJCgq5pguzb9LF3Ly4afl21GrUgcXKxWd/E7jRPdHDHzfo3N/YvDyb vFRY6Zq1MKLcKWcHiQaEb3LudnfV1pB6Ju2RbG/of/71BjqhU71U9mhwINGf93GnzROV tHIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=zokvkdPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020a50c314000000b004355a6f9844si5003395edb.206.2022.06.29.19.39.08; Wed, 29 Jun 2022 19:39:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=zokvkdPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbiF3Cag (ORCPT + 99 others); Wed, 29 Jun 2022 22:30:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231887AbiF3CaU (ORCPT ); Wed, 29 Jun 2022 22:30:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D96102FFEA for ; Wed, 29 Jun 2022 19:30:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 956A561962 for ; Thu, 30 Jun 2022 02:30:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CDFDC34114; Thu, 30 Jun 2022 02:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1656556208; bh=NnybmbeAGGn2R9XqSjtu72EBzlcQuCDFvjoFj0kGor8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=zokvkdPOolcqpwXgwOO/60AcLiBNevbBePZMYXAwx2dg3TDmLQtANAexZYqgs8MFY gKJOWFU/IKaw57VgNqZHSY9oxsLGBjaJvTvSuWnqz+gQtBdbreUCBjtVUzT832/cF6 NUXTZ9cUQpPwBhnvJyNOkDaDUcqJFNkpZS9o2Jkw= Date: Wed, 29 Jun 2022 19:30:06 -0700 From: Andrew Morton To: Feng Tang Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dave.hansen@intel.com, Joerg Roedel , Robin Murphy Subject: Re: [RFC PATCH] mm/slub: enable debugging memory wasting of kmalloc Message-Id: <20220629193006.77e9f071a5940e882c459cdd@linux-foundation.org> In-Reply-To: <20220630014715.73330-1-feng.tang@intel.com> References: <20220630014715.73330-1-feng.tang@intel.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 30 Jun 2022 09:47:15 +0800 Feng Tang wrote: > kmalloc's API family is critical for mm, with one shortcoming that > its object size is fixed to be power of 2. When user requests memory > for '2^n + 1' bytes, actually 2^(n+1) bytes will be allocated, so > in worst case, there is around 50% memory space waste. > > We've met a kernel boot OOM panic, and from the dumped slab info: > > [ 26.062145] kmalloc-2k 814056KB 814056KB > > >From debug we found there are huge number of 'struct iova_magazine', > whose size is 1032 bytes (1024 + 8), so each allocation will waste > 1016 bytes. Though the issue is solved by giving the right(bigger) > size of RAM, it is still better to optimize the size (either use > a kmalloc friendly size or create a dedicated slab for it). Well that's nice, and additional visibility is presumably a good thing. But what the heck is going on with iova_magazine? Is anyone looking at moderating its impact?