On 03/27/2012 06:35 PM, Thiago Macieira wrote:

[...]

1) prelink refused to work on ELF modules with text relocations,
which excluded the NVidia libs outright

I'm using the --reloc-only option, which works fine even on our non-PIC
x86 binaries.

Prelinking helps with load time processing, but not with reducing
memory footprint.

You'll find that this is wrong, it is necessary to achieve the results I described below.

However, the linux ELF loader currently has a bug that causes the
second type of relocation to be overwritten even if prelink had
already initialized them to the correct value. This causes the
memory in the relocation sections to get dirtied without anything
being changed, which contradicts our goal.

That might explain my results too.

Attached is a proof-of-concept patch which fixes this issue for the
x86_64 Linux ELF loader. By both applying this patch to the loader
and prelinking libnvidia-glcore.so, distros can reduce the memory
overhead of linking an application against the NVIDIA libGL to just
a few kB:

Interesting. Those are very good results. Can you provide the same
results when two applications are running? Our hope is that those
6544 kB of Private_Clean (which are sharable) become actually shared
and move to Shared_Clean.

Yes, they do:

------

7fc000000000-7fc00192a000 r-xp 00000000 08:01 1591924
 /usr/lib/libnvidia-glcore.so.295.33
Size:              25768 kB
Rss:                9108 kB
Pss:                3037 kB
Shared_Clean:       9108 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:         9108 kB
Anonymous:             0 kB
AnonHugePages:         0 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB
7fc00192a000-7fc001b2a000 ---p 0192a000 08:01 1591924
 /usr/lib/libnvidia-glcore.so.295.33
Size:               2048 kB
Rss:                   0 kB
Pss:                   0 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            0 kB
Anonymous:             0 kB
AnonHugePages:         0 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB
7fc001b2a000-7fc002309000 rwxp 0192a000 08:01 1591924
 /usr/lib/libnvidia-glcore.so.295.33
Size:               8060 kB
Rss:                6592 kB
Pss:                3320 kB
Shared_Clean:       6544 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:        48 kB
Referenced:         6592 kB
Anonymous:            48 kB
AnonHugePages:         0 kB
Swap:                  0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB

------

As you can see, everything functions as expected and the NVIDIA driver
isn't the problem here; it's very unfortunate that everyone already
relayed the opposite information.

Has this patch been submitted to the glibc folks? They have just had
a change of governance.

No, it's just a proof-of-concept at this stage. I'll submit it for
review later after cleaning it up and adding support for i386 relocations.

Thanks,
 - Pierre-Loup
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to