On Wed, Sep 21, 2005 at 08:19:31PM +0100, Hugh Dickins wrote:
On Wed, 21 Sep 2005, Frank van Maarseveen wrote:...
What about calling
static inline void grow_total_vm(struct mm_struct *mm, unsigned long increase)
{
mm->total_vm += increase;
if (mm->total_vm > mm->hiwater_vm)
mm->hiwater_vm = mm->total_vm;
}
whenever total_vm is increased and possibly doing something similar for rss at
different places? If it is not on the fast path then it's not necessary to
#ifdef the thing anywhere.
But I think you're right that hiwater_vm is best updated where total_vm
is: I'm not sure if it covers all cases completely (I think there's one
or two places which don't bother to call __vm_stat_account because they
believe it won't change anything), but in principle it would make lots of
sense to do it in the __vm_stat_account which typically follows adjusting
total_vm, as you did, and if possible nowhere else; rather than adding
your inline above.
But update_mem_hiwater() is called at various places too, and I guess that
covers merely the total_vm increase, not rss.
Maybe above inline should replace update_mem_hiwater()?