Hi Thomas, On Mon, Feb 14, 2022 at 9:28 AM Thomas Zimmermann <tzimmermann@xxxxxxx> wrote: > Am 14.02.22 um 09:05 schrieb Geert Uytterhoeven: > > On Thu, Feb 10, 2022 at 4:24 PM Thomas Zimmermann <tzimmermann@xxxxxxx> wrote: > >> Fbdev's deferred I/O sorts all dirty pages by default, which incurs a > >> significant overhead. Make the sorting step optional and update the few > >> drivers that require it. Use a FIFO list by default. > >> > >> Sorting pages by memory offset for deferred I/O performs an implicit > >> bubble-sort step on the list of dirty pages. The algorithm goes through > >> the list of dirty pages and inserts each new page according to its > >> index field. Even worse, list traversal always starts at the first > >> entry. As video memory is most likely updated scanline by scanline, the > >> algorithm traverses through the complete list for each updated page. > >> > >> For example, with 1024x768x32bpp a page covers exactly one scanline. > >> Writing a single screen update from top to bottom requires updating > >> 768 pages. With an average list length of 384 entries, a screen update > >> creates (768 * 384 =) 294912 compare operation. > > > > What about using folios? > > If consecutive pages are merged into a single entry, there's much less > > (or nothing in the example above) to sort. > > How would the code know that? Calls to page_mkwrite happen > pagefault-by-pagefault in any order AFAICT. fb_deferred_io_mkwrite() would still be called for a page, but an adjacent page can be merged with an existing entry while adding it to the list. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx 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