This Time Self-Hosted
dark mode light mode Search

Dirty RSS and compiled pci IDs

I was looking around for targets for improvements on COW memory, and I’ve stumbled across one of Xorg’s private mappings:

flame@enterprise ~ % sudo smem `pidof X` | grep pcidata
     196 kb        0 kb      196 kb   /usr/lib64/xorg/modules/libpcidata.so
      68 kb        0 kb       68 kb   /usr/lib64/xorg/modules/libpcidata.so
     536 kb      344 kb        0 kb   /usr/lib64/xorg/modules/libpcidata.so

It’s quite some amount of memory used here. The problem is that libpcidata contains a lot of strings that need to e relocated. What those strings are? Well, simply a C compiled version of the pci.ids file.

Of course it’s faster to access pci.ids data at runtime after compiling it in C code at buildtime, but is it a good thing to do?

I admit I don’t know Xorg that well, but as far as I can see, the PCI scan happens when you actually start Xorg, as it’s used to identify the video card. So it’s saving time during Xorg’s bootup to use the compiled version rather than the system version. On the other hand it’s using a lot of memory during the rest of runtime, for no apparent good reason (to me at least).

I know the code is mostly historical, and I also know that requiring people using Xorg to install pciutils might be a bit farfetched, but really, I’ve read that on Planet Freedesktop too, if I recall correctly, we’re continuing reinventing the wheel.

My take on all this is that we should get pci.ids, usb.ids and whatever else data we can in one single big package, released by one single big project, and then let all the package rely on that single copy of it.

If any other distributor is reading this, let me know what you think, maybe we could get this done by all asking together to the authors.

Comments 2
  1. It would help to merge all strings in just one separated by and an array of pointers to these.And yes, this could be a binary blob that could be mmap()ed, read and closed, doing the same thing, with the same speed and saving memory.

  2. There’s no need for that to be a blob actually, a single element in @.rodata@ would be enough to fix the issue of pcidata.But what I’m thinking of right now would be to have a shared cachefile for these things. More about this will come in the next days I’m sure 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.