From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752399AbcBAJcm (ORCPT ); Mon, 1 Feb 2016 04:32:42 -0500 Received: from www.linutronix.de ([62.245.132.108]:37743 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbcBAJcl (ORCPT ); Mon, 1 Feb 2016 04:32:41 -0500 Date: Mon, 1 Feb 2016 10:31:33 +0100 (CET) From: Thomas Gleixner To: Peter Zijlstra cc: riel@redhat.com, linux-kernel@vger.kernel.org, fweisbec@gmail.com, mingo@kernel.org, luto@amacapital.net, clark@redhat.com Subject: Re: [PATCH 1/4] sched,time: remove non-power-of-two divides from __acct_update_integrals In-Reply-To: <20160201092223.GL6357@twins.programming.kicks-ass.net> Message-ID: References: <1454292751-23472-1-git-send-email-riel@redhat.com> <1454292751-23472-2-git-send-email-riel@redhat.com> <20160201092223.GL6357@twins.programming.kicks-ass.net> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Feb 2016, Peter Zijlstra wrote: > On Mon, Feb 01, 2016 at 09:37:00AM +0100, Thomas Gleixner wrote: > > On Sun, 31 Jan 2016, riel@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. Yeah, noticed after hitting Send :)