Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4678607ybg; Mon, 8 Jun 2020 14:08:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyCfTGWvGBrNXYOuqvs8WE/Y4kpj2QK9p7UDGbopLEoJJQZ9txhNBE+VFiHp0NtBkBTArf X-Received: by 2002:a05:6402:1714:: with SMTP id y20mr24026326edu.81.1591650534347; Mon, 08 Jun 2020 14:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591650534; cv=none; d=google.com; s=arc-20160816; b=HJK1BTdj9Tf2uCG669Wq+U4UgwKwYouKx173cD8EWjAkXClO4Uyk8LmNmYC5dC8fkV aL+KLHxMu4JgjAJtrjOTSIcPst7kT+20rnpJBkleWKAditbks7teMg5Jkns5iaVZvEyF tLWnM7eAyCiLDP5lth4Lc2a1zXmj1i1Xn4l5wtpQv+2yBkXmOl5hUrIJw7FueW6iiLNB XMZIeknWpzfpPwSaToUls5c9I/zyTvIaR7F6q9mw5QXWVNii0jXVSZNssbT6iztCJs70 Jj79LUrvLNFb9d5WOvZ2kTALDFj2tNymHwpzTLLR7taWS9O1mPuBGKVBm3E8OVmAilTd ejqg== 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:dkim-signature; bh=eSnM3Wp5cYoCyZSe8AmKJn6Xd5E1PvqbOrfDYBEtlVE=; b=VA8vMJZyPHFxm+OtI0W3vknqyHmlPTo50njt8RlwL9y7orNUki7HwEz/pKjRmI/8gN kxs+4jh/huclH0+u/NyVyHxMAgvQFgtx9HnKIXJvI5qhSDTBVRfF5K+hSEz2VxVJIpio 08qREDkHxE58Xf8Awy0CYtOyBNQpXF6+m7WqtXllxupIx6G0fT0j2oXypnq+ovVXV/Zr KwCQeZIydW4W4qYycvv9Dc1fxiIfC14lhQEshA9c4MeoIzcmpezxSoZGXeVnSY/t5taO fYZORVmTaaB6rABU+fukdfpMZ05QlUkjOPySxnjkh+b44UUrToYGWkbMvLoFbB7cDaUF 9g2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NDE9XGnG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si8822491edv.497.2020.06.08.14.08.31; Mon, 08 Jun 2020 14:08:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NDE9XGnG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726734AbgFHVET (ORCPT + 99 others); Mon, 8 Jun 2020 17:04:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbgFHVES (ORCPT ); Mon, 8 Jun 2020 17:04:18 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D20BCC08C5C2 for ; Mon, 8 Jun 2020 14:04:18 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id s23so7768370pfh.7 for ; Mon, 08 Jun 2020 14:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=eSnM3Wp5cYoCyZSe8AmKJn6Xd5E1PvqbOrfDYBEtlVE=; b=NDE9XGnGI9GYA5H7RMhAelnFzVf+AvRcTPveRM4qk/20TZGUzk7Nl5BFlxeKNEqqk1 Cl1giFXgHlqX15N7iQucJJcOoPHw6fZ6ffQdKr0X2W7LKnaUuGDih/MGil6dsPc32JUA DBqX50+ae1zSTFqe7EhMBHlw2YclobMchWAJUAC2Mv5dF9lx25Vg/7VhyNy/xEEldbm2 IrHs7R46EfOtXDCmt6m4EYGEQIzbiFgPU8dQ5bTTeYADq9Eh2A/mVZiBurdYo7gb6YMz RWF57ZajeU3jjvemUOpsXll7rfy2utMv2pNLaRFQ8W5zk9lFK1MSWKvKDbuRQ1clzKgD jJPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=eSnM3Wp5cYoCyZSe8AmKJn6Xd5E1PvqbOrfDYBEtlVE=; b=JhOBYu7XxSKgxqnbPZ6/X/8fC2TIKwuEwWWX0mPXPRwDEFZ7ifzEYrrl/UtumDE7MX gOC7qO4zDj7h0PSABqaCSsnUbUkhdf+42lOHfx2SWq4xbAVdZY2rmyJvuEj58ihrKllP NyG+adH+hrStbfYgbrM3ny8Iki8OU5J78M2RUfeYgAl3NzVvi8UKnpCEgETNn3aDNQpT 871k+BU8H2PO/Tgqg16DPvgmGTviNvZU5gOXGCdKX1zCfzTeh+rCN5T2Vk7n+pq66j08 ZXEMuqGFi71fAvGAkPAhuQRZ/sdUHxvsQB4JEgCvfwygs7ux03FP4GzSCg7aU0wy1KEd G4bg== X-Gm-Message-State: AOAM5326rfu1LXfsTdkmcJ7IvjV4Z8EGsefwBjRsNCR/iTu7wKmh9lUC i2q/t9Tbp1E91B8eYhkAKuSbnQ== X-Received: by 2002:a65:6107:: with SMTP id z7mr21088332pgu.341.1591650257907; Mon, 08 Jun 2020 14:04:17 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id z8sm360368pjr.41.2020.06.08.14.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 14:04:17 -0700 (PDT) Date: Mon, 8 Jun 2020 14:04:16 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Geert Uytterhoeven cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] dma-pool: Fix too large DMA pools on medium systems In-Reply-To: <20200608132217.29945-1-geert@linux-m68k.org> Message-ID: References: <20200608132217.29945-1-geert@linux-m68k.org> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Jun 2020, Geert Uytterhoeven wrote: > On systems with at least 32 MiB, but less than 32 GiB of RAM, the DMA > memory pools are much larger than intended (e.g. 2 MiB instead of 128 > KiB on a 256 MiB system). > > Fix this by correcting the calculation of the number of GiBs of RAM in > the system. Invert the order of the min/max operations, to keep on > calculating in pages until the last step, which aids readability. > > Fixes: 1d659236fb43c4d2 ("dma-pool: scale the default DMA coherent pool size with memory capacity") > Signed-off-by: Geert Uytterhoeven This works as well and is much more readable. Thanks Geert! Acked-by: David Rientjes