Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp890103ybl; Fri, 31 Jan 2020 09:48:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzc1WBt7G6lKLmQy6ZLI4+ZKRx/BvNI/oJU/uUXvecmuwGfsGjLl83l36NwpMkBD++pKV9P X-Received: by 2002:a05:6830:1d7b:: with SMTP id l27mr8009783oti.251.1580492903280; Fri, 31 Jan 2020 09:48:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580492903; cv=none; d=google.com; s=arc-20160816; b=BAeVKkOWQq7KDw4b+dwCtAQqA7ODNBYckDRywdBFNzdrm6X3BLU6O4EeYznv++tfg3 0W4yhNTb1fs0qWyh3/jshXnVZrD0QWd6wH/l3gZQ21R7AiGntFrjbMsH1JxJUEBg5qBT n/PdHmVNji+3bqbyLs2a9Y9wzPt7+S5I25MjWNJlmsFBSrhwrvfCt/wLh0tfaUlQ2Vhg /kNYydJHSt9JK3vV5so8hRzqjqLyoCZaaiOcbJ6SWou5l6bvEqYQKIqu168LEEvTwbfV bVUFw2S72ST2eSC63BfBLj72zZ+MGLAgIfuFGK1ws6JI/a/Sf+UU9Mqi3ceIntQGZEuR XR1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3ITIYxvjdW6ILwWjvX2q5KM4Bzin3GdLXvp+v9lOz74=; b=I5qqcWWiUHwF2tnV7ZHjmvAjR2p+GlD+EuUTZb4ouAIo8OJlWaAvHJI9WYOJeyzHuD TxespAOPpO+z48uG3TsgS7YorcDxp2M6BvpfbphCUNjeZcX0nZtnm6J6Zzex2U8BprcA XSgjiCiuIzm1B28L9S2nK3RDuB7ihIgraupIW1TeP6g3rboqj3U6LstVv4Br9Hb/jory +w0b+6PrxArEpOBxggdIoREIaIRQiUDk0bw1F5rHJHjv7M5J0tkLsiknoqRk7FxksPvY BeitIqgPmWhWGMo4DQuTC/6IkhehfyUUZPamNQt0iqxGxfSWDKH79QD9YXytxx19AFdW h+Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=f51xeAjb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si4852800oig.25.2020.01.31.09.48.10; Fri, 31 Jan 2020 09:48:23 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=f51xeAjb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbgAaRqT (ORCPT + 99 others); Fri, 31 Jan 2020 12:46:19 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:41772 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbgAaRqT (ORCPT ); Fri, 31 Jan 2020 12:46:19 -0500 Received: by mail-yw1-f68.google.com with SMTP id l22so5497241ywc.8 for ; Fri, 31 Jan 2020 09:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3ITIYxvjdW6ILwWjvX2q5KM4Bzin3GdLXvp+v9lOz74=; b=f51xeAjbaVVP2IVpMfik9MTfen2NXpvClIXLVLIYOetotxF5htPYc8GsLV1l/I5hVp h0sKKB3M+TCM7FVtW72qf1cOVYbmBmDXaCwnFbym4AaJ/y/70JMvqkhcXASMoYkLRW0/ JbFS1nKPC1Eqpl/YYUJ4B+onY7flQFuZ97rn+SBEB581DzfbKOF0CrMAsERj15kREJsW NIraCl9smResGaW8WxnirUxmCdDw5y3+JNUPlwY5TIuP5MSVCmMtVY7EUeX/N07K4SSF RTAIMP713WAlZEP30cl668OM5afd43ncdPfNTOqDv+M96mI+hDI4d432MwZ4ZnEFhLTv A8dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3ITIYxvjdW6ILwWjvX2q5KM4Bzin3GdLXvp+v9lOz74=; b=SjUI0eh6wCQh6aKlJwnK7c/8xBGOIkUR79vrtzacuwSCgRS+qHfdLegHwTRmcd0dp4 eHRcpZy22Wnf+apQwHpN3O6zmYWqnLE/5Vl02Tdlj8lSyTE90GLZTIEbnbHYjF74on36 AmY4lS7eJFmVPFB3AZQlqy3XZhi7CfpJh6kPmrsjz0BVbAwm/rklQvHBll8AGwIRAIos 9yUcqxIVn7p7MTHg5vr+IyKJGsAr+b07YJGOYrmBDRgodSLQZiQgt34OIgIbzhnh4hlg wqfj5YY5UDgZ3bI2DN/j0tEIge+jccE2LOlXEOurPfrfEg3l/4Tmc+g/DaVeCwoSsmQC YXuw== X-Gm-Message-State: APjAAAXnExy8SC3G1gra3MXdTeoh87YaCePG4qYHa9eMgAu/DPa63ljc eWyhORcokPcEdos6PotQKEM/AkM05Kp3RaY1CcNqwQ== X-Received: by 2002:a25:d9d4:: with SMTP id q203mr1615912ybg.274.1580492777976; Fri, 31 Jan 2020 09:46:17 -0800 (PST) MIME-Version: 1.0 References: <20200130191049.190569-1-edumazet@google.com> <62e1ee46-ad9e-988f-a2a3-8fd217e28f24@arm.com> In-Reply-To: <62e1ee46-ad9e-988f-a2a3-8fd217e28f24@arm.com> From: Eric Dumazet Date: Fri, 31 Jan 2020 09:46:06 -0800 Message-ID: Subject: Re: [PATCH] dma-debug: dynamic allocation of hash table To: Robin Murphy Cc: Christoph Hellwig , Joerg Roedel , iommu@lists.linux-foundation.org, Eric Dumazet , Geert Uytterhoeven , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 9:43 AM Robin Murphy wrote: > > On 31/01/2020 2:42 pm, Eric Dumazet wrote: > > On Fri, Jan 31, 2020 at 4:30 AM Robin Murphy wrote: > >> > >> ...and when that represents ~5% of the total system RAM it is a *lot* > >> less reasonable than even 12KB. As I said, it's great to make a debug > >> option more efficient such that what it observes is more representative > >> of the non-debug behaviour, but it mustn't come at the cost of making > >> the entire option unworkable for other users. > >> > > > > Then I suggest you send a patch to reduce PREALLOC_DMA_DEBUG_ENTRIES > > because having 65536 preallocated entries consume 4 MB of memory. > > ...unless it's overridden on the command-line ;) > > > Actually this whole attempt to re-implement slab allocations in this > > file is suspect. > > Again that's a matter of expected usage patterns - typically the > "reasonable default" or user-defined preallocation should still be > enough (as it *had* to be before), and the kind of systems that can > sustain so many live mappings as to regularly hit the dynamic expansion > path are also likely to have enough memory not to care that later-unused > entries never get 'properly' freed back to the kernel (plus as you've > observed, many workloads tend to reach a steady state where entries are > mostly only transiently free anyway). The reasoning for the exact > implementation details is there in the commit logs. > > > Do not get me wrong, but if you really want to run linux on a 16MB host, > > I guess you need to add CONFIG_BASE_SMALL all over the places, > > not only in this kernel/dma/debug.c file. > > Right, nobody's suggesting that defconfig should "just work" on your > router/watch/IoT shoelaces/whatever, I'm just saying that tuning any > piece of common code for datacenter behemoths, for quality-of-life > rather than functional necessity, and leaving no way to adjust it other > than hacking the source, would represent an unnecessary degree of > short-sightedness that we can and should avoid. > > Taking a closer look at the code, it appears fairly straightforward to > make the hash size variable, and in fact making it self-adjusting > doesn't seem too big a jump from there. I'm happy to have a go at that > myself if you like. Sure, go ahead, I have no plan implementing changes for 20 years old platforms. Thanks.