Opened 7 months ago

Last modified 5 weeks ago

#14831 new bug

Optimize packagefs memory usage

Reported by: s40in Owned by: bonefish
Priority: normal Milestone: Unscheduled
Component: File Systems/packagefs Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #10163
Has a Patch: no Platform: All

Description (last modified by diver)

Haiku Beta1 consumes 262MB
When booted in unpacked version Beta1 consumes only 148MB
Which is almost 120MB less RAM.
See screenshots

Attachments (4)

Haiku unpacked mem.jpg (110.3 KB) - added by s40in 7 months ago.
Haiku hpkg_mem.jpg (81.2 KB) - added by s40in 7 months ago.
Haiku hpkg.jpg (65.4 KB) - added by s40in 7 months ago.
Haiku unpacked.jpg (69.0 KB) - added by s40in 7 months ago.

Download all attachments as: .zip

Change History (14)

Changed 7 months ago by s40in

Attachment: Haiku unpacked mem.jpg added

Changed 7 months ago by s40in

Attachment: Haiku hpkg_mem.jpg added

comment:1 Changed 7 months ago by diver

Component: File SystemsFile Systems/packagefs
Description: modified (diff)
Keywords: packagefs hpkg removed
Owner: changed from nobody to bonefish
Summary: Packagefs memory leakpackagefs memory leak

Changed 7 months ago by s40in

Attachment: Haiku hpkg.jpg added

Changed 7 months ago by s40in

Attachment: Haiku unpacked.jpg added

comment:2 Changed 7 months ago by waddlesplash

I'm not sure that's a memory leak. packagefs seems to use a lot of memory for internal data structures; while this could be optimized, I don't know of any leaks here.

comment:3 Changed 7 months ago by diver

Summary: packagefs memory leakOptimize packagefs memory usage

comment:4 Changed 7 months ago by axeld

Same thoughts here. Would be nice to investigate where this memory is going to, though, just to know. I find the difference acceptable in principle, at least.

BTW: How would I build a Haiku version without PM? That sounds interesting to improve the turn-around times when doing kernel development.

comment:5 Changed 7 months ago by cb88

120MB is bloaty to the point of ridiculous though... even if it isn't a memory leak per se.

I assume this has something to do with how data structures that are needed to implement a single coherent filesystem out of all the packages are implemented... perhaps the packages themselves could restructured so that the data structures that are needed can just be mmaped directly from the hpkgs and leave the rest up to cache instead of actually loading things into memory. If it already does that then it seems there is some other problem...

Memory wasted to packagefs is memory you don't have for cache...it seems to make the installer unbootable on my 512MB system also (need to retest since beta).

I guess any shine through R/W files might cause overhead as well?

Last edited 7 months ago by cb88 (previous) (diff)

comment:6 in reply to:  4 Changed 7 months ago by diver

Replying to axeld:

BTW: How would I build a Haiku version without PM? That sounds interesting to improve the turn-around times when doing kernel development.

IIUC, you need to copy your /system folder to another bfs partition, delete everything in system/packages except for haiku_loader hpkg. I havn't tried it myself, tho.

comment:7 Changed 3 months ago by waddlesplash

After the O_NOCACHE change, is there any improvement here?

Also, what's the cached vs. used memory? (See ActivityMonitor.) We only really care about more "used" memory, "cached" memory usually can be reused.

comment:8 Changed 6 weeks ago by diver

Blocking: 10163 added

comment:9 Changed 5 weeks ago by diver

Haiku uses 290MB in hrev53259 right after boot.

comment:10 Changed 5 weeks ago by diver

Cached memory is at 430MB.

Note: See TracTickets for help on using tickets.