[PATCH 2/2] fbdev: Don't sort deferred-I/O pages by default

Thomas Zimmermann tzimmermann at suse.de
Mon Feb 14 13:29:46 UTC 2022


Hi

Am 14.02.22 um 10:05 schrieb Geert Uytterhoeven:
> Hi Thomas,
> 
> On Mon, Feb 14, 2022 at 9:28 AM Thomas Zimmermann <tzimmermann at suse.de> wrote:
>> Am 14.02.22 um 09:05 schrieb Geert Uytterhoeven:
>>> On Thu, Feb 10, 2022 at 4:24 PM Thomas Zimmermann <tzimmermann at suse.de> 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.

I still don't understand how we'd use it to our advantage. Most drivers 
don't need sorted pages at all. A folio has strong alignment 
requirements for size and offset AFAICT. We might end up flushing way 
too much of the display memory.

Best regards
Thomas

> 
> Gr{oetje,eeting}s,
> 
>                          Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
> 
> 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

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20220214/fe59a965/attachment.sig>


More information about the dri-devel mailing list