My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 119: Doubt in code : userspace/ohsm.c ohsm_enable()
1 person starred this issue and may be notified of changes. Back to list
Status:  In-progress
Owner:  charles....@gmail.com


 
Project Member Reported by charles....@gmail.com, Aug 2, 2009
Hello Vineet, RKS,

These are some lines of code from userspace/ohsm.c fun: ohsm_enable ()


dev_info =
>    (struct ohsm_tier_dev_info *) malloc(sizeof(struct ohsm_tier_dev_info));
>   allocpol =
>    (struct ohsm_allocation_policy *)
>     malloc(sizeof(struct ohsm_allocation_policy));
>   relocpol =
>    (struct ohsm_reloc_policy *)malloc(sizeof(struct ohsm_reloc_policy));


Here we are dynamically allocating memory to pointers.

Can you please explain the need of dynamically allocating the memory here
Aug 2, 2009
Project Member #1 imreckless@gmail.com
Yes we all know that.

We have removed all the static structures
way back somewhere in revision 140, all the 
policy structures are now dynamic.

And ohsm_enable() function in ohsm.c initializes these
policies, so we can do so only after allocating memory.
These pointers are then checked inside admin.c.
We have then used well defined interfaces like copy_from_user
to copy the policies inside our kernel module.




Aug 2, 2009
Project Member #2 greg.fre...@gmail.com
Charles,

If I have it right, they had a static policy array, but at this point it is simply
unknown how many policies will suffice.

Thus a dynamic approach was selected to allow for future tuning of the max policies.
 This has the biggest effect in user space because comparing newly created files will
be in the hot path of file creation.

The team can correct me if I'm wrong, but I don't think this has been analyzed in
detail yet.

Powered by Google Project Hosting