Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp136842ybx; Wed, 30 Oct 2019 12:33:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZ7U5xXt6ckszvpRBYeuev3f34xy9vzmWjZE48Mr2Aga0fBW3KFJoLepmszA1QcXvLMvzc X-Received: by 2002:aa7:c80d:: with SMTP id a13mr1573660edt.59.1572463987276; Wed, 30 Oct 2019 12:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572463987; cv=none; d=google.com; s=arc-20160816; b=Sswq8O9rnoVvN9Bj5vTkfRiK18W1jOq5fJ1/r25akeuoq8jMv5G4TzHGhBdc9kRWOT QkZHwhqRzv4iFvNKbJz8n+Zi4zc086eQjC9M4ApXkMc8L+woqVWRiMWgGLIQzoPwhl1X VJyDCF7ARsc2RBp/RkEOXekBvCTevr4BOpd6Mva6m7EaA49NIf+UFCYZWDBFY8ffoW2c Vp6kwbRNZJ4TTG4D2y7maTr95Zi194Ds7ycCNzTwYeKUVOqr5SiyCl/fhjG4wXlL/BGN rDxIymrSRWy62idu/l7NwZ6m8hvjJLiHM/cQ6QQgns4b54ik9VKMt+AMty1ZnnLm5R+h Mq0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=uliOILcdGqX5lDV+IjP9VAomclbVJ2rwkFNcUJMZq6M=; b=WIMECQb3+93S0Tn/hLmXgeo5rf0pBm7IIhGMykaMRZuBEyjZkQcRKMGRdYCSGaZTFE Fcs7khtSvealSFoUiFfaYahhFxSjpZkF1HTSweyM5xr/2PHHXbxEWg/CzoIJyp0ye3Qv 8A3RKtkcakV2y4xn+e2d7bc9z652UPrnRq2Sa9Wvi6SJecmebr+JTdey8JdqwbCUfoei 529K97JfD3fkQgf4pydfQP1NPWbw9YGue5o8/cLYnSV2YumPCZ9O2lcK/vzRndVvsGNt /zPCl6fF9P+6Ls05OKxwFUKczsIMOZOZKZF+nkCRbhBzolFBNNYLk18j4O8B6Gc1cxDb skng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=siJ8geBf; 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 h43si2095105edb.89.2019.10.30.12.32.43; Wed, 30 Oct 2019 12:33:07 -0700 (PDT) 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=siJ8geBf; 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 S1726584AbfJ3TcK (ORCPT + 99 others); Wed, 30 Oct 2019 15:32:10 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:45102 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbfJ3TcJ (ORCPT ); Wed, 30 Oct 2019 15:32:09 -0400 Received: by mail-pf1-f201.google.com with SMTP id a14so2504603pfr.12 for ; Wed, 30 Oct 2019 12:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=uliOILcdGqX5lDV+IjP9VAomclbVJ2rwkFNcUJMZq6M=; b=siJ8geBfdRqmEXkq6dLKWbC8UtCivAfXu9Ev9lpcqXAqFzlOYFyY7zN9HvPABllkzQ O6LahLFQV+H74an3iQO5p3Zrcr2jai2ra3n2C0MJRNXyhptbzhAirJtyAakCpNAGKtzi GGqsLAVap3zP8gvB88u11PFpI/OgaXigz1I86mcWz8dPQsbgRNiZRu6xzf30K0+3cpp3 PRiTdhz/OjUU5lg4Z8WJJ3tH+4BXkak5okVJTcSzQWjRgP6lhbF/E6Y9tzhXyNxZyU3q GoIOnXNW42clAt3gmJT7/qy8vwD3KKxj0hL5gJEgZLt5Pioe8Y/X0wn1cfOgjrL87XIL lT2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=uliOILcdGqX5lDV+IjP9VAomclbVJ2rwkFNcUJMZq6M=; b=jhtf6/iUvHfPhpWkVhFqSYXt/RKjtE/cAJTxM/wd1K9iXA7TxJfWQk6qL99uRQy5Dz RgXzIpXcoGzdpsSdNcAXQqiDuVSY1i1W/23aLvx/heb1bw9NY3fI/rzcmGp8y+5dGYYa XX9uVPJmj8XCZYHwNYiogoh08O1LXL5Be+WKAcNFZU8MGrr3VkLKrWR0/WW2/rFqvoXk 9iJP4T2AryzvG7X+Bm29oVDn3USuY0ww4YTmywRQDBldjjH7Z34pHfk1LVXdcmxAzyuJ 3wT4jR57N02iMXG/ZgxDu+x5oADIdGtxek3LARFFWU9EbNuTI5mJkQXYsxGLu/jCpdTo R0Yw== X-Gm-Message-State: APjAAAX75wC7IN2xqc1ZPHL+Rfn7kOT736QcaW5LoN7aIeyJBZDgKl79 Mo1IZpPhm7HllFyP4WXOfrLlhu5zOMtJ/g== X-Received: by 2002:a63:5406:: with SMTP id i6mr1092706pgb.1.1572463927459; Wed, 30 Oct 2019 12:32:07 -0700 (PDT) Date: Wed, 30 Oct 2019 12:32:04 -0700 Message-Id: <20191030193204.133327-1-edumazet@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog Subject: [PATCH dma-debug: reorder struct dma_debug_entry fields From: Eric Dumazet To: Christoph Hellwig Cc: linux-kernel , Eric Dumazet , Eric Dumazet , Marek Szyprowski 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 This patch moves all fields used during exact match lookups to the first cache line. This makes debug_dma_mapping_error() and friends about 50% faster. Since it removes two 32bit holes, force a cacheline alignment on struct dma_debug_entry. Signed-off-by: Eric Dumazet Cc: Christoph Hellwig Cc: Marek Szyprowski --- kernel/dma/debug.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index 35e2a853bff9c482d789ab331d79aaee07753a97..004496654aaa543a52fdd6684af5a87ef02ff054 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -54,33 +54,33 @@ enum map_err_types { * struct dma_debug_entry - track a dma_map* or dma_alloc_coherent mapping * @list: node on pre-allocated free_entries list * @dev: 'dev' argument to dma_map_{page|single|sg} or dma_alloc_coherent - * @type: single, page, sg, coherent - * @pfn: page frame of the start address - * @offset: offset of mapping relative to pfn * @size: length of the mapping + * @type: single, page, sg, coherent * @direction: enum dma_data_direction * @sg_call_ents: 'nents' from dma_map_sg * @sg_mapped_ents: 'mapped_ents' from dma_map_sg + * @pfn: page frame of the start address + * @offset: offset of mapping relative to pfn * @map_err_type: track whether dma_mapping_error() was checked * @stacktrace: support backtraces when a violation is detected */ struct dma_debug_entry { struct list_head list; struct device *dev; - int type; - unsigned long pfn; - size_t offset; u64 dev_addr; u64 size; + int type; int direction; int sg_call_ents; int sg_mapped_ents; + unsigned long pfn; + size_t offset; enum map_err_types map_err_type; #ifdef CONFIG_STACKTRACE unsigned int stack_len; unsigned long stack_entries[DMA_DEBUG_STACKTRACE_ENTRIES]; #endif -}; +} ____cacheline_aligned_in_smp; typedef bool (*match_fn)(struct dma_debug_entry *, struct dma_debug_entry *); -- 2.24.0.rc0.303.g954a862665-goog