Bug 1748774 - Incorrect power of two calculation in mem_pool_get_fn
Summary: Incorrect power of two calculation in mem_pool_get_fn
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: core
Version: 7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL:
Whiteboard:
Depends On: 1722802
Blocks: 1722801 1724210
TreeView+ depends on / blocked
 
Reported: 2019-09-04 07:38 UTC by Rinku
Modified: 2019-09-16 02:03 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1722802
Environment:
Last Closed: 2019-09-16 02:03:19 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Gluster.org Gerrit 23354 None Merged core: fix memory allocation issues 2019-09-16 02:03:18 UTC

Description Rinku 2019-09-04 07:38:11 UTC
+++ This bug was initially created as a clone of Bug #1722802 +++

+++ This bug was initially created as a clone of Bug #1722801 +++


Description of problem:

The method used to calculate the power of two value for a type is off by 1 causing twice the required amount of memory to be allocated.
For example, cComparing the information for inode_t in statedumps from 3.4.4 and 3.5.0:

3.4.4:
------

pool-name=inode_t                                                               
active-count=15408                                                              
sizeof-type=168                                                                 
padded-sizeof=256                                                               
size=3944448                                                                    
shared-pool=0x7fac27a7b468                                                      
-----=-----                



3.5.0:
------
pool-name=inode_t                                                               
active-count=2                                                                  
sizeof-type=255     <--- actual sizeof inode_t is 168                                                               
padded-sizeof=512   <--- padded size is twice the required amount                                                            
size=1024                                                                       
shared-pool=0x7f1103b5b6d0





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

How reproducible:


Steps to Reproduce:
1. Create volume, fuse mount it and create some files and dirs on it
2. Take a statedump of the gluster mount process (kill -SIGUSR1 <pid>)
3. Compare the sizeof-type and padded-sizeof values in the state releases.

Actual results:
The padded-sizeof is twice the smallest power of two value for sizeof-type + sizeof(obj header)

Expected results:

The padded-sizeof should be the smallest power of two value for sizeof-type + sizeof(obj header)


Additional info:

--- Additional comment from RHEL Product and Program Management on 2019-06-21 11:10:14 UTC ---

This bug is automatically being proposed for the next minor release of Red Hat Gluster Storage by setting the release flag 'rhgs‑3.5.0' to '?'. 

If this bug should be proposed for a different release, please manually change the proposed release flag.

--- Additional comment from Worker Ant on 2019-06-21 11:15:29 UTC ---

REVIEW: https://review.gluster.org/22921 (core: fix memory allocation issues) posted (#4) for review on master by Xavi Hernandez

--- Additional comment from Worker Ant on 2019-06-26 08:58:16 UTC ---

REVIEW: https://review.gluster.org/22921 (core: fix memory allocation issues) merged (#7) on master by Atin Mukherjee

Comment 1 Worker Ant 2019-09-04 07:40:47 UTC
REVIEW: https://review.gluster.org/23354 (core: fix memory allocation issues) posted (#1) for review on release-7 by Rinku Kothiya

Comment 2 Worker Ant 2019-09-16 02:03:19 UTC
REVIEW: https://review.gluster.org/23354 (core: fix memory allocation issues) merged (#6) on release-7 by Atin Mukherjee


Note You need to log in before you can comment on or make changes to this bug.