From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7562DC00454 for ; Tue, 10 Dec 2019 14:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56E4820828 for ; Tue, 10 Dec 2019 14:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727854AbfLJOzU (ORCPT ); Tue, 10 Dec 2019 09:55:20 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:41533 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727420AbfLJOzT (ORCPT ); Tue, 10 Dec 2019 09:55:19 -0500 Received: by mail-ot1-f65.google.com with SMTP id r27so15701560otc.8; Tue, 10 Dec 2019 06:55:19 -0800 (PST) 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=sxfx8pYcfnvd3lqW1qImtgwu7XzTFQuwrY147FPzqGI=; b=YRyoRk57De2c4zcSJKKnR566euN0kLevtMG85WIwzl6M5FpKJB8pwbGP7AXKM/AxNd Nld0WUKfOFGhYIP/P9/7IIHExb8cIuXnM2VW/xex87Lf5HVnpdP+yYZU174NpKDyQRqc 2lQt2tl7oYMNaEalKntzAUizrWIu8B49ampjbXzPOC4n2KaUwLcPzTLHIk2VqO4abL8n QjNJ1sFFblQfRywwVVOrgjukQnGbtxQ9ISQBA+XLye86Jh/jJc/lzK6TjDoOQ5pheEkr LmVFfg6HKM+rjMQ2DaOyJQ4QOd2/zeDn5oj/guSfnIwQvfgcJ55XIdh1eE8uDWCdC3U1 CXtg== X-Gm-Message-State: APjAAAWk81x3IigLOJ6XIdcsylnqR2yoJuBQKGsBAL23Rtm7sziZQ8S+ x6acJ/4ojIc5MjGLF5ICbGRdyGWB1Sgva0N0gRY= X-Google-Smtp-Source: APXvYqyvpesdaROFU80iQbYfg6jNyZzt/R79xRmZAAQaMqkHwq20yaDGs/xYgnPW9xtctjeHu1wtxLpcUrAqR6E22Hg= X-Received: by 2002:a9d:6c81:: with SMTP id c1mr24883423otr.39.1575989718977; Tue, 10 Dec 2019 06:55:18 -0800 (PST) MIME-Version: 1.0 References: <20191030184844.84219-1-edumazet@google.com> In-Reply-To: <20191030184844.84219-1-edumazet@google.com> From: Geert Uytterhoeven Date: Tue, 10 Dec 2019 15:55:08 +0100 Message-ID: Subject: Re: [PATCH] dma-debug: increase HASH_SIZE To: Eric Dumazet Cc: Christoph Hellwig , linux-kernel , Eric Dumazet , Marek Szyprowski , Linux-Renesas 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 Wed, Oct 30, 2019 at 8:13 PM Eric Dumazet wrote: > With modern NIC, it is not unusual having about ~256,000 active dma > mappings. Hash size of 1024 buckets is too small. > > Forcing full cache line per bucket does not seem useful, > especially now that we have a contention on free_entries_lock > for allocations and freeing of entries. Better using space > to fit more buckets. > > Signed-off-by: Eric Dumazet > Cc: Christoph Hellwig > Cc: Marek Szyprowski > --- > kernel/dma/debug.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c > index 4ad74f5987ea9e95f9bb5e2d1592254e367d24fb..35e2a853bff9c482d789ab331d79aaee07753a97 100644 > --- a/kernel/dma/debug.c > +++ b/kernel/dma/debug.c > @@ -27,7 +27,7 @@ > > #include > > -#define HASH_SIZE 1024ULL > +#define HASH_SIZE 16384ULL > #define HASH_FN_SHIFT 13 > #define HASH_FN_MASK (HASH_SIZE - 1) > > @@ -87,7 +87,7 @@ typedef bool (*match_fn)(struct dma_debug_entry *, struct dma_debug_entry *); > struct hash_bucket { > struct list_head list; > spinlock_t lock; > -} ____cacheline_aligned_in_smp; > +}; > > /* Hash list to save the allocated dma addresses */ > static struct hash_bucket dma_entry_hash[HASH_SIZE]; JFTR, this increases dma_entry_hash size by 327680 bytes, and pushes a few more boards beyond their bootloader-imposed kernel size limits. Disabling CONFIG_DMA_API_DEBUG fixes that. Of course the real fix is to fix the bootloaders... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds