Why we Use both mm_users and mm_count in struct mm_struct{ }

Niroj Pokhrel nirojpokhrel at gmail.com
Sat Mar 23 01:02:12 EDT 2013


Hi all,
I have been going through the Address Space in the linux and came across
two variables in the struct mm_struct and I'm a bit confused about the two:
struct mm_struct
{
              ..........
              atomic_t   mm_users;
              atomic_t   mm_count;
              ............
}
Basically, after reading through I came to understand that mm_users are
used to store the number of processes or threads using the memory so
depending upon the number of users it is going to be set.
But, I am confused with mm_count, it is said the mm_count is increment by
one for all the mm_users and when all the mm_users value is reduced to zero
then mm_count is reduced. So, my question is can the value of mm_count be
ever greater than one because all the mm_users are equivalent to mm_count .
So, if not then why are we using the mm_count as we can simply remove the
memory areas whenever the mm_users count reduce to zero.
May be the explanation is simple but I'm lost. Thanking all of you in
advance.


Regards,
Niroj Pokhrel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130323/c04e3ebf/attachment.html 


More information about the Kernelnewbies mailing list