[PATCH 0/1] Look for ModuleData only in appropriate library

Michal Srb msrb at suse.com
Wed Jun 27 08:59:02 PDT 2012

Hi, proposing this for consideration.

The module loader now looks for <modulename>ModuleData symbol using
dlsym(RTLD_DEFAULT, name) function. That searches using the default library
search order. Appart from being hypothetically slower, it increases the
reference counter for the module library when the symbol is found. Causing that
the library is not unloaded from memory when/if UnloadModule is called.

If the library handle from dlopen is used instead, the library gets unloaded
correctly. (fbdev_drv.so and modesetting_drv.so were really unloaded on my test
machine, making 80KB difference.)

The gains from speed or memory size are negligible, but it seems like correct
thing to do imho.

Michal Srb (1):
  Look for ModuleData only in apropriate library.

 hw/xfree86/loader/loader.c  |    8 +++++++-
 hw/xfree86/loader/loader.h  |    1 +
 hw/xfree86/loader/loadmod.c |    2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)


More information about the xorg-devel mailing list