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 <[email protected]>
AuthorDate: 2022-04-21 19:01:55 +0000
Commit:     John Baldwin <[email protected]>
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.

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?


...
-static void
-free_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map)
-{
-       struct bounce_page *bpage;
-
-       while ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) {
-               STAILQ_REMOVE_HEAD(&map->bpages, links);
-               free_bounce_page(dmat, bpage);
-       }
-}

--
Bjoern A. Zeeb                                                     r15:7

Reply via email to