[Bugs] [Bug 1649037] New: Translators allocate too much memory in their xlator_mem_acct_init()

bugzilla at redhat.com bugzilla at redhat.com
Mon Nov 12 18:33:28 UTC 2018


https://bugzilla.redhat.com/show_bug.cgi?id=1649037

            Bug ID: 1649037
           Summary: Translators allocate too much memory in their
                    xlator_mem_acct_init()
           Product: GlusterFS
           Version: mainline
         Component: core
          Severity: medium
          Assignee: bugs at gluster.org
          Reporter: ykaul at redhat.com
                CC: bugs at gluster.org



Description of problem:
If I'm looking at most xlators, they use it with something like (random
example):
gf_mt_jbr_end

which is defined in xlators/experimental/jbr-server/src/jbr-internal.h as:
enum {
    gf_mt_jbr_private_t = gf_common_mt_end + 1,
    gf_mt_jbr_fd_ctx_t,
    gf_mt_jbr_inode_ctx_t,
    gf_mt_jbr_dirty_t,
    gf_mt_jbr_end
};


What is the value of gf_common_mt_end ? Some number, defined in
libglusterfs/src/mem-types.h as 150 or so (did not really count or looked, but
seen it's quite a large list)

So gf_mt_jbr_end ends up being 155 or so.
Then in xlator_mem_acct_init(), I see these:
   xl->mem_acct = MALLOC(sizeof(struct mem_acct) +
                          sizeof(struct mem_acct_rec) * num_types);

Which seems to me that we are allocating plenty of mem_acct_rec structs, even
if we only need 5 or so? We are clearly allocating and then memsetting and
probably not using way too many mem_acct_rec records.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list