Skip to content

(Unneeded?) Memory bloat in fair::mq::shmem::Message  #477

@ktf

Description

@ktf

While doing some profiling I just noticed that the fair::mq::shmem::Message has a fQueued boolean in the middle of it, introducing some unneeded extra padding. If I naively move it to the MetaHeader class, I immediately go from 96 bytes to 88.

I also suspect one could gain quite some extra memory with a few extra reasonable limitations. For example:

  • fAlignment at the moment is a size_t, while it could easily be a char storing log2 (assuming no one needs alignment which is not a power of 2).
  • size and hint could be limited to 48 bits, leaving space for the above mentioned fAlignment, fQueued, fManaged to be stored there.
  • removing the hint (which at the moment it's not actually used for anything, AFAICT) altogether one could get down to 72 bytes.

All in all, I think one could get down below 64 bytes by having something like the following:

  struct  __attribute__((__packed__)) Message : public fair::mq::Message // Extra 16 bytes from this
  {
    Manager* fManager;
    mutable UnmanagedRegion* fRegionPtr;
    mutable char* fLocalPtr;
    int16_t fRegionId;
    int16_t fSegmentId;
    size_t fSize: 48;
    size_t fHandle: 48;
    size_t fShared: 48;
    size_t fAlignment: 14;
    size_t fManaged: 1;
    size_t fQueued: 1;
  };

and it could probably be even less if one used handles for fManager and the the other pointers. Do you think there is any space to evolve the managed region to go into this direction?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions