From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932166AbcHOJYf (ORCPT ); Mon, 15 Aug 2016 05:24:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35954 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753174AbcHOJYd (ORCPT ); Mon, 15 Aug 2016 05:24:33 -0400 Date: Mon, 15 Aug 2016 11:21:28 +0200 From: Stanislaw Gruszka To: Wanpeng Li Cc: Ingo Molnar , Giovanni Gherdovich , Ingo Molnar , Peter Zijlstra , Mike Galbraith , "linux-kernel@vger.kernel.org" , Mel Gorman Subject: Re: [PATCH 1/1] sched/cputime: Mitigate performance regression in times()/clock_gettime() Message-ID: <20160815092127.GB19741@redhat.com> References: <1470385316-15027-1-git-send-email-ggherdovich@suse.cz> <1470385316-15027-2-git-send-email-ggherdovich@suse.cz> <20160810112641.GA30126@gmail.com> <20160812121010.GA30199@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 15 Aug 2016 09:24:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 15, 2016 at 05:13:30PM +0800, Wanpeng Li wrote: > 2016-08-12 20:10 GMT+08:00 Stanislaw Gruszka : > > Hi > > > > On Wed, Aug 10, 2016 at 01:26:41PM +0200, Ingo Molnar wrote: > >> Nice detective work! I'm wondering, where do we stand if compared with a > >> pre-6e998916dfe3 kernel? > >> > >> I admit this is a difficult question: 6e998916dfe3 does not revert cleanly and I > >> suspect v3.17 does not run easily on a recent distro. Could you attempt to revert > >> the bad effects of 6e998916dfe3 perhaps, just to get numbers - i.e. don't try to > >> make the result correct, just see what the performance gap is, roughly. > >> > >> If there's still a significant gap then it might make sense to optimize this some > >> more. > > > > I measured (partial) revert performance on 4.7 using mmtest instructions > > from Giovanni and also tested some other possible fix (draft version): > > > > diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c > > index 75f98c5..54fdf6d 100644 > > --- a/kernel/sched/cputime.c > > +++ b/kernel/sched/cputime.c > > @@ -294,6 +294,8 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) > > unsigned int seq, nextseq; > > unsigned long flags; > > > > + (void) task_sched_runtime(tsk); > > + > > rcu_read_lock(); > > /* Attempt a lockless read on the first round. */ > > nextseq = 0; > > @@ -308,7 +310,7 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) > > task_cputime(t, &utime, &stime); > > times->utime += utime; > > times->stime += stime; > > - times->sum_exec_runtime += task_sched_runtime(t); > > + times->sum_exec_runtime += t->se.sum_exec_runtime; > > If this will not have updated stats for other threads? No, until tick/sched() on CPUs running threads. Stanislaw