From: riel@redhat.com
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, peterz@infradead.org, fweisbec@gmail.com,
clark@redhat.com, luto@amacapital.net, mingo@kernel.org
Subject: [PATCH 2/4] acct,time: change indentation in __acct_update_integrals
Date: Mon, 1 Feb 2016 14:21:04 -0500 [thread overview]
Message-ID: <1454354466-31309-3-git-send-email-riel@redhat.com> (raw)
In-Reply-To: <1454354466-31309-1-git-send-email-riel@redhat.com>
From: Rik van Riel <riel@redhat.com>
Change the indentation in __acct_update_integrals to make the function
a little easier to read.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Rik van Riel <riel@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@redhat.com>
---
kernel/tsacct.c | 51 ++++++++++++++++++++++++++-------------------------
1 file changed, 26 insertions(+), 25 deletions(-)
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 460ee2bbfef3..d12e815b7bcd 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -125,31 +125,32 @@ void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
static void __acct_update_integrals(struct task_struct *tsk,
cputime_t utime, cputime_t stime)
{
- if (likely(tsk->mm)) {
- cputime_t time, dtime;
- unsigned long flags;
- u64 delta;
-
- local_irq_save(flags);
- time = stime + utime;
- dtime = time - tsk->acct_timexpd;
- /* Avoid division: cputime_t is often in nanoseconds already. */
- delta = cputime_to_nsecs(dtime);
-
- if (delta < TICK_NSEC)
- goto out;
-
- tsk->acct_timexpd = time;
- /*
- * Divide by 1024 to avoid overflow, and to avoid division.
- * The final unit reported to userspace is Mbyte-usecs,
- * the rest of the math is done in xacct_add_tsk.
- */
- tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm) >> 10;
- tsk->acct_vm_mem1 += delta * tsk->mm->total_vm >> 10;
- out:
- local_irq_restore(flags);
- }
+ cputime_t time, dtime;
+ unsigned long flags;
+ u64 delta;
+
+ if (!likely(tsk->mm))
+ return;
+
+ local_irq_save(flags);
+ time = stime + utime;
+ dtime = time - tsk->acct_timexpd;
+ /* Avoid division: cputime_t is often in nanoseconds already. */
+ delta = cputime_to_nsecs(dtime);
+
+ if (delta < TICK_NSEC)
+ goto out;
+
+ tsk->acct_timexpd = time;
+ /*
+ * Divide by 1024 to avoid overflow, and to avoid division.
+ * The final unit reported to userspace is Mbyte-usecs,
+ * the rest of the math is done in xacct_add_tsk.
+ */
+ tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm) >> 10;
+ tsk->acct_vm_mem1 += delta * tsk->mm->total_vm >> 10;
+out:
+ local_irq_restore(flags);
}
/**
--
2.5.0
next prev parent reply other threads:[~2016-02-01 19:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 19:21 [PATCH 0/4 v4] sched,time: reduce nohz_full syscall overhead 40% riel
2016-02-01 19:21 ` [PATCH 1/4] sched,time: remove non-power-of-two divides from __acct_update_integrals riel
2016-02-01 19:21 ` riel [this message]
2016-02-01 19:21 ` [PATCH 3/4] time,acct: drop irq save & restore " riel
2016-02-01 19:21 ` [PATCH 4/4] sched,time: only call account_{user,sys,guest,idle}_time once a jiffy riel
2016-02-01 20:00 ` Eric Dumazet
2016-02-01 20:08 ` Rik van Riel
-- strict thread matches above, loose matches on Subject: below --
2016-02-11 1:08 [PATCH 0/4 v6] sched,time: reduce nohz_full syscall overhead 40% riel
2016-02-11 1:08 ` [PATCH 2/4] acct,time: change indentation in __acct_update_integrals riel
2016-02-11 1:23 ` Joe Perches
2016-02-02 17:19 [PATCH 0/4 v5] sched,time: reduce nohz_full syscall overhead 40% riel
2016-02-02 17:19 ` [PATCH 2/4] acct,time: change indentation in __acct_update_integrals riel
2016-02-01 2:12 [PATCH 0/4 v3] sched,time: reduce nohz_full syscall overhead 40% riel
2016-02-01 2:12 ` [PATCH 2/4] acct,time: change indentation in __acct_update_integrals riel
2016-01-30 3:36 [PATCH 0/2] sched,time: reduce nohz_full syscall overhead 40% riel
2016-01-30 3:36 ` [PATCH 2/4] acct,time: change indentation in __acct_update_integrals riel
2016-01-30 16:15 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454354466-31309-3-git-send-email-riel@redhat.com \
--to=riel@redhat.com \
--cc=clark@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).