Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2562783rbb; Wed, 28 Feb 2024 05:59:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVzhpIcA4TZnRyJXetY6U3nCKUH3rKTnPTJKDqdFoVCYEtIH/SQWB9ng/ZEdmyaJwdHH6Ab5Kre9SqL/H1oO4tmAdUNL/ttvz0O14rkhA== X-Google-Smtp-Source: AGHT+IG1og4v7ERRj9hRN8B9cA7o5eAr/Jj9+NEC57B+emdV+0YTRKNlsbzR+O71FouSz8wsCCGl X-Received: by 2002:a05:6a20:c991:b0:19c:6297:13b1 with SMTP id gy17-20020a056a20c99100b0019c629713b1mr5578806pzb.58.1709128772107; Wed, 28 Feb 2024 05:59:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709128772; cv=pass; d=google.com; s=arc-20160816; b=Pyo6wSrMXssTuVFvNdg0bbGShS49YeIwpnOqb4X269rxO3sp5AlHXnhPcKSk67Kx9h U/Gv0agYkgSX0mDWbOwMj8NxCakRPrqH/DuDpwderUmf5TPNGgcCxKnjMdGfj4P2dUAi xpnUpe6YcrOC273D9aUv3kX5KskTPOAnQfUHSBReK2q9HqB/kdfNf1+BmPjxvh3MS/tm OBc2KwfHIjAPH/6VchEAghCOQoRivTCHpfMEpZA/N15hCd6X/UR2ScG6elFdtLZ4OmLi v5pz6NCGQSYY1m4nCZuP+dagA/wjsy+okPiTmGruS/+aksn67C4kPeul7i/GJ+fjVkUA ZhjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yKJtWXMUUZDiSXU7ORRKFKfyXQXAcRzYJs0Ixf4Gg2s=; fh=E8F5/vp/nAcPVJWJwVt5RE8c2HME7kVqVeSMFxe8huE=; b=vadzZl2ZOWNxYi0Jf5C43YZ+SzSViE9sC0/bLBMmYfCvUYw0LQkZ+hy7j6lWm8ahPD GkE7F1xjfjVL3DuAx2eYaf/0V19Ahqfda1b+22n4byRWZevB6Wafky63NEfAdxpX2fsc I7KRelSSxG//fa/e+AiTkBuaXWYc6FHB/bTfvSlIBBoJp+R/9IMSso6b52pgo1ZHjZ+1 T5lFVoD7rFKzXJQESNAlPIqgeQPQKaebaE+gjGDVuAaJwBna6m+MPJLjbaBqWtZ3CF7E RUFP486517aKKS+sBIik9LfRk1rrzBtcKknZY2g3ka7/aimUfgX6DqZh55t+UjHHoATl jnxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZHQNrkmE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85115-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85115-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y14-20020a634b0e000000b005e4901151ddsi1727653pga.92.2024.02.28.05.59.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:59:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85115-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZHQNrkmE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85115-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85115-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B76EBB26A1E for ; Wed, 28 Feb 2024 13:41:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92E6914F97A; Wed, 28 Feb 2024 13:39:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZHQNrkmE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA2AF158D83; Wed, 28 Feb 2024 13:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709127592; cv=none; b=CWtVK5q5VSgRtIiypKjQwA/UYgbBrKEFYF/4eRiuSxYNkjDqmpzUXHQrVdQsAi/BvehnYecJKXgNFkSfUFaukmEa2ZsYJ6Qe5s5HbHBj4aWIUPyKxq22Jf6q9l9agcsxk8jMqp5VB5JyU+ekSa2y3zFgM7wfMtmbDuy3rhpst6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709127592; c=relaxed/simple; bh=aD3tZMex9G2YUndtdrq37+tQDE+4+Pl1DCirhnA679E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jTA7KXf2yOI5fF1qjcRs65BuzpXmMpJHT0EAtlB1vci3rlaoQdswlacdQScfCeU0FTUEJOPqwzcsJgFTPPAmv5JJ9WIakXQcMFh4DQJpifhNNZ6k8VhtvRtpovD7ypn69WsJO6G84xYwQGYJDJbKQ94n5E3DPQjFSWqLb2KCKZ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZHQNrkmE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2895CC433A6; Wed, 28 Feb 2024 13:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709127592; bh=aD3tZMex9G2YUndtdrq37+tQDE+4+Pl1DCirhnA679E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHQNrkmEgy12WEFe8Jv/6qBhkOgpWG2e1degZiyvn0LRnsKBkD8hP4JCuu/CpirRZ E5WF8pyyGcE2r60DIS5WmAChmo8/4oGap1B0RpdsQBkyekKbiqQXkgZisyOndf5F1I CslGRSqiwlNv/3k8HP/jQ3oEozzZ9SRJVXLmjraro47W5uHsqGvgl5iwzEv+p8g86Y SuAOP/Yv0HD5yJun+tFlSvNzuxnwf9mQzayPmRpn9BwYrwTDEu+aLsLwpQoYNHbO3W VugD2V8V/AXwfyavEVwlfOy6PrZtVkypRCqeIldUmtlJVwuBTG8baksKhrDOgEV83W grPbgFR7fX4bQ== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , iommu@lists.linux.dev, Christoph Hellwig , Marek Szyprowski , Robin Murphy , Petr Tesarik , Dexuan Cui , Nicolin Chen , Michael Kelley Subject: [PATCH v5 6/6] swiotlb: Remove pointless stride adjustment for allocations >= PAGE_SIZE Date: Wed, 28 Feb 2024 13:39:30 +0000 Message-Id: <20240228133930.15400-7-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240228133930.15400-1-will@kernel.org> References: <20240228133930.15400-1-will@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit For swiotlb allocations >= PAGE_SIZE, the slab search historically adjusted the stride to avoid checking unaligned slots. However, this is no longer needed now that the code around it has evolved and the stride is calculated from the required alignment. Either 'alloc_align_mask' is used to specify the allocation alignment or the DMA 'min_align_mask' is used to align the allocation with 'orig_addr'. At least one of these masks is always non-zero. In light of that, remove the redundant (and slightly confusing) check. Link: https://lore.kernel.org/r/SN6PR02MB4157089980E6FC58D5557BCED4572@SN6PR02MB4157.namprd02.prod.outlook.com Reported-by: Michael Kelley Signed-off-by: Will Deacon --- kernel/dma/swiotlb.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index c381a7ed718f..0d8805569f5e 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -1006,13 +1006,6 @@ static int swiotlb_search_pool_area(struct device *dev, struct io_tlb_pool *pool */ stride = get_max_slots(max(alloc_align_mask, iotlb_align_mask)); - /* - * For allocations of PAGE_SIZE or larger only look for page aligned - * allocations. - */ - if (alloc_size >= PAGE_SIZE) - stride = umax(stride, PAGE_SHIFT - IO_TLB_SHIFT + 1); - spin_lock_irqsave(&area->lock, flags); if (unlikely(nslots > pool->area_nslabs - area->used)) goto not_found; -- 2.44.0.rc1.240.g4c46232300-goog