From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756255AbdJJOBI (ORCPT ); Tue, 10 Oct 2017 10:01:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45170 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755688AbdJJOBH (ORCPT ); Tue, 10 Oct 2017 10:01:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 27911883C1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=riel@redhat.com Message-ID: <1507644062.21121.179.camel@redhat.com> Subject: Re: [PATCH 1/1] sched/cputime: do not decrease steal time after live migration on xen From: Rik van Riel To: Peter Zijlstra , Stanislaw Gruszka Cc: Ingo Molnar , Dongli Zhang , Wanpeng Li , Xiaolong Ye , Frederic Weisbecker , linux-kernel@vger.kernel.org, xen-devel@lists.xen.org, mingo@redhat.com, dario.faggioli@citrix.com, bevan@bi-co.net, xen.list@daevel.fr, joao.m.martins@oracle.com Date: Tue, 10 Oct 2017 10:01:02 -0400 In-Reply-To: <20171010124816.ujbjwqow4axpzgk2@hirez.programming.kicks-ass.net> References: <1507626848-24148-1-git-send-email-dongli.zhang@oracle.com> <20171010105925.mla7tpdh6stlxie3@gmail.com> <20171010124201.GD8263@redhat.com> <20171010124816.ujbjwqow4axpzgk2@hirez.programming.kicks-ass.net> Organization: Red Hat, Inc Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 10 Oct 2017 14:01:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-10-10 at 14:48 +0200, Peter Zijlstra wrote: > On Tue, Oct 10, 2017 at 02:42:01PM +0200, Stanislaw Gruszka wrote: > > > > + u64 steal, steal_time; > > > > + s64 steal_delta; > > > > + > > > > + steal_time = > > > > paravirt_steal_clock(smp_processor_id()); > > > > + steal = steal_delta = steal_time - this_rq()- > > > > >prev_steal_time; > > > > + > > > > + if (unlikely(steal_delta < 0)) { > > > > + this_rq()->prev_steal_time = > > > > steal_time; > > > > I don't think setting prev_steal_time to smaller value is right > > thing to do.  > > > > Beside, I don't think we need to check for overflow condition for > > cputime variables (it will happen after 279 years :-). So instead > > of introducing signed steal_delta variable I would just add > > below check, which should be sufficient to fix the problem: > > > > if (unlikely(steal <= this_rq()->prev_steal_time)) > > return 0; > > How about you just fix up paravirt_steal_time() on migration and not > muck with the users ? Not just migration, either. CPU hotplug is another time to fix up the steal time.