From nobody Fri May 06 15:59:41 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8D3721ACC893; Fri, 6 May 2022 15:59:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KvwHf3bXSz3pqR; Fri, 6 May 2022 15:59:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651852782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HUr3eYx2lQ5y6p6BAbnioU+LCMQvLZ4PRQekfBGgVq4=; b=HjSCi7W2cZbD0ZcgveVm+zfXYz3OrDScN419HUQeGBaON/naX521RyEsps+nryoN8lTifg JbL4A+1U1I3gL6uxsYdFwtuD0da5OKEindp4+6gx2OprnwainhEYNa9GSfgiOzcgjDDkm3 bDwXVaxbGwC1Bd53am7fcjdrvmjrbHdbpUT77KkORbERNWfbBhELgh7GkwOKuYwH5BMXI+ RBWQk1Ib5u6PqsAWt13xFN+ZHBZjYJcQrxjxU0Cy8O5ZCqVXWQSGPETr2hu3PsbZmMOvzx Mx02GdtXulro/KIJGQH9aE3UKRCuud1hSziZhPN755WwArTYzhVxN1qIP9G/Sw== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id DE0FB2EF5F; Fri, 6 May 2022 15:59:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Fri, 6 May 2022 08:59:41 -0700 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: "Bjoern A. Zeeb" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202204211902.23LJ2bug035892@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: 92e40a9b9241 - main - busdma_bounce: Batch bounce page free operations when possible. In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651852782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HUr3eYx2lQ5y6p6BAbnioU+LCMQvLZ4PRQekfBGgVq4=; b=w5nCpXDOxYR1a7duUH866zENTEgpXuZIK6vQ6q0vC8d1oZBKaVwLPhfHxm1qxIQYYCe3FX kCo/5OiB8WJyHZOjA5Kh1Ia5KCPTVusv/+NT1bcVdBNQYyAKLRgYha8oVt7aZOwb48SeEK 1eeSMG+DnWb42VkEuBMGgxKH3q1bqD6ZZ85i/WdY7rnx1irCOtwgkHmF5YU3IIDL7Lx/Hp qEjYDGkvAhIzkUlIGuKERthG3KOYd6ljEU1GdBjBLVT5O5teW2JP2gCqegAscvwxtT645N Vf1iaWpkE7qEJHQRDAGfMFD8orNeSHVtCYhdIXbQvjICKkItc667TrDvyVbTvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651852782; a=rsa-sha256; cv=none; b=qK+WPqcMG70Wr8V4fTHcfhdkmOdMlB+vUyIsdNE9J9YRD+e2/tnKsqXrORqgyowK2sI8v5 JE2uZLgjvNAAEWD46XHbiaxWIMzEg7YACpyXQDgx1kg8k6i4A1O3OjX2vkZQCpscFNZ9e/ cBaU6AQaUFyCOM91kQTGNsnjqohlFaZ6J7tBKWuOcAWrTelrenBTLvOW8pb1m6Wzjp2ReZ Oo/rtFTMVydHyl92hk0OxL5yx5HOKW6XmmZ2P7s6EBSeUssA3PbDLWg7dFsNWuBXeRIba/ 3el1jr5nRzhzHhv+V9PwQuIDiqrPl56XDtrm9hhEReHjl8p5hVxdzJRnUsqx+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 5/6/22 4:59 AM, Bjoern A. Zeeb wrote: > On Thu, 21 Apr 2022, John Baldwin wrote: > >> The branch main has been updated by jhb: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=92e40a9b9241313b3d16543819ccd8d642bb11a5 >> >> commit 92e40a9b9241313b3d16543819ccd8d642bb11a5 >> Author: John Baldwin >> AuthorDate: 2022-04-21 19:01:55 +0000 >> Commit: John Baldwin >> CommitDate: 2022-04-21 19:01:55 +0000 >> >> busdma_bounce: Batch bounce page free operations when possible. >> >> Reviewed by: imp >> Differential Revision: https://reviews.freebsd.org/D34968 >> --- >> sys/kern/subr_busdma_bounce.c | 69 +++++++++++++++++++++---------------------- >> 1 file changed, 34 insertions(+), 35 deletions(-) >> >> diff --git a/sys/kern/subr_busdma_bounce.c b/sys/kern/subr_busdma_bounce.c >> index 243da8e9487f..f3699cf2ad27 100644 >> --- a/sys/kern/subr_busdma_bounce.c >> +++ b/sys/kern/subr_busdma_bounce.c >> @@ -382,55 +382,54 @@ add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr, >> } >> >> static void >> -free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage) >> +free_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map) >> { > ... >> mtx_lock(&bounce_lock); >> - STAILQ_INSERT_HEAD(&bz->bounce_page_list, bpage, links); > ... >> + STAILQ_CONCAT(&bz->bounce_page_list, &map->bpages); > > > This changes an aspect we had discussed in a different context of a > change I had proposed to keep the pages ordered in order to fullfill > multi-page nseg=1 requests better. You could fix that by doing two CONCAT operations perhaps: STAILQ_CONCAT(&map->bpages, &bz->bounce_page_list); STAILQ_CONCAT(&bz->bounce_page_list, &map->bpages); You'd definitely need a comment explaining why and ideally some use case that shows a benefit. That said, STAILQ_CONCAT are O(1) operations that I think are 4 assignments each, so relatively cheap. > In the new case your "possibly still cache hot" pages are no longer > at the beginning of the bounce_page_list but at the end? > > If this is no longer considered to be an issue, contigous page space > still is, so I wondere if a change to keep the pages ordered would be > accepted more likely now? FWIW, this change actually keeps multi-segment page batches more in order as they would retain their relative order in bz->bounce_page_list on free rather than being reversed. -- John Baldwin