On Mon, Feb 01, 2016 at 09:37:00AM +0100, Thomas Gleixner wrote:
> On Sun, 31 Jan 2016, r...@redhat.com wrote:
> > @@ -93,9 +93,9 @@ void xacct_add_tsk(struct taskstats *stats, struct 
> > task_struct *p)
> >  {
> >     struct mm_struct *mm;
> >  
> > -   /* convert pages-usec to Mbyte-usec */
> > -   stats->coremem = p->acct_rss_mem1 * PAGE_SIZE / MB;
> > -   stats->virtmem = p->acct_vm_mem1 * PAGE_SIZE / MB;
> > +   /* convert pages-nsec/1024 to Mbyte-usec, see __acct_update_integrals */
> > +   stats->coremem = p->acct_rss_mem1 * PAGE_SIZE / (1000 * KB);
> > +   stats->virtmem = p->acct_vm_mem1 * PAGE_SIZE / (1000 * KB);
> 
> You replace "/ (1024 * 1024)" by "/ (1000 * 1024). So that's introducing a non
> power of 2 division instead of removing one and wont compile on systems which
> do not have a 64/32 division in hardware.

Yep, so that needs to be fixed to use do_div(). But the reason for this
is that this is the consumer side of these stats and therefore rarely
executed.

This patch effectively moves a div out of the fast path into the slow
path.

Reply via email to