Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1326662iob; Fri, 29 Apr 2022 03:02:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycMwswtvhOyoWk+BrGwbXXmZ1sz9xx7nt0dbsGZZtrKxUekKnjjMqSvz7wDBnMNRsEWXxl X-Received: by 2002:a05:6512:ac3:b0:472:ecc:6f0e with SMTP id n3-20020a0565120ac300b004720ecc6f0emr15018987lfu.205.1651226543061; Fri, 29 Apr 2022 03:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651226543; cv=none; d=google.com; s=arc-20160816; b=OsF+ksh4Nc9WGuIRW3gZ9kbwIP3iDr5fjDYGfQuT1khz+I09n1/NUChQQvL2No9ug+ TmjS/csqETXT/OhFLwkCFWlBreTuFSaIg+Kt9QS9Ysp0EkxAHFVl+F4cyS0425vInnml HatIeRD4+9Ba9ukZeTlKmelz++6sB5csC5/kBNn7A0nOT4S6N1YnXU8K/XTNxJVdCTF/ RgolsaHtsOYm1/WdUmo6KevtMNm8TG9MEcNIZ2F5jsKtt0tqbczCOFb3O/W6NZwZ4Uxb aZWb8PQESo54pl8aUAXE/o+UJSAlgi2PI4nhVNLS+DPqa7m3dA5n7lo+9znB2EOTApia xSGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:jabber-id:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=K1Ucnor/Z1cqCDHOmHdHkdz7IYcVUk6mea6efCXAgOA=; b=1DFnFHUDUf5OuMebjveW1fsa6q7wi01SPvdGTOZA1i2NT+ENMuoy/aCypXN2aBJFIr ngdSE9Or94qx7DShaBa/z0iTUCoSv3eWNxAisYp59F6Qx/dqxvclHNZ8HczkmB54CrrN OFc6KhcDgjAgq38dfnPbEus1+LCcmJkMh/k4DI8Pp59UD5iimiqQhka9k0a6GJjzFdVa M4skpcxw9X7/IZ/bxYOYH11IBDL+5vqAaQjTOctnxmWedg+zpAmvSDaPjf1h6YJ+PD2B qGw8WuuoLhvneJx82fDWsht1HPPdVKJZnNdD3TOp73O3SmhMAFggbkiFHOGYAlts2e7B 4duA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=LSPywKfc; 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 r1-20020a2eb601000000b0024dbc0f2247si6811155ljn.246.2022.04.29.03.01.54; Fri, 29 Apr 2022 03:02:23 -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=fail header.i=@weissschuh.net header.s=mail header.b=LSPywKfc; 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 S236296AbiD1QM2 (ORCPT + 99 others); Thu, 28 Apr 2022 12:12:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232927AbiD1QM1 (ORCPT ); Thu, 28 Apr 2022 12:12:27 -0400 X-Greylist: delayed 20983 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 28 Apr 2022 09:09:12 PDT Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4FB64A3E0 for ; Thu, 28 Apr 2022 09:09:12 -0700 (PDT) Date: Thu, 28 Apr 2022 18:09:11 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1651162151; bh=EFIxJKLXRND1+RqQt43Rt2lySMTfl9maJOfaKECS52E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LSPywKfczIqIU5RFrDA+zcwxNzF9vfVLeaZAoggwkKgC/w8NPn92Igcqvupp4iLVl 3zvapYjzdZ8PtOY/FeJDohJxFgYpaemZV+7c27hwuw4jXfx+bcdcqR1TQvyrdp3C2D uw2VnGKYlScHzfH2D1JmOs1tnB92ZTE6vHTr3Xpk= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Christoph Hellwig Cc: Keith Busch , Jens Axboe , Sagi Grimberg , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Subject: Re: [PATCH] nvme-pci: fix host memory buffer allocation size Message-ID: <676c02ef-4bbc-43f3-b3e6-27a7d353f974@t-8ch.de> References: <20220428101922.14216-1-linux@weissschuh.net> <20220428143603.GA20460@lst.de> <5060d75e-46c0-4d29-a334-62c7e9714fa7@t-8ch.de> <20220428150644.GA22685@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220428150644.GA22685@lst.de> Jabber-ID: thomas@t-8ch.de X-Accept: text/plain, text/html;q=0.2, text/*;q=0.1 X-Accept-Language: en-us, en;q=0.8, de-de;q=0.7, de;q=0.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 2022-04-28 17:06+0200, Christoph Hellwig wrote: > On Thu, Apr 28, 2022 at 04:44:47PM +0200, Thomas Weißschuh wrote: > > Is the current code supposed to reach HMPRE? It does not for me. > > > > The code tries to allocate memory for HMPRE in chunks. > > The best allocation would be to allocate one chunk for all of HMPRE. > > If this fails we half the chunk size on each iteration and try again. > > > > On my hardware we start with a chunk_size of 4MiB and just allocate > > 8 (hmmaxd) * 4 = 32 MiB which is worse than 1 * 200MiB. > > And that is because the hardware only has a limited set of descriptors. Wouldn't it make more sense then to allocate as much memory as possible for each descriptor that is available? The comment in nvme_alloc_host_mem() tries to "start big". But it actually starts with at most 4MiB. And on devices that have hmminds > 4MiB the loop condition will never succeed at all and HMB will not be used. My fairly boring hardware already is at a hmminds of 3.3MiB. > Is there any real problem you are fixing with this? Do you actually > see a performance difference on a relevant workload? I don't have a concrete problem or performance issue. During some debugging I stumbled in my kernel logs upon "nvme nvme0: allocated 32 MiB host memory buffer" and investigated why it was so low.