Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1832770pxb; Mon, 13 Sep 2021 06:33:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxj3UQQP/Z3HB414l1evXvx3rGiErNPKP+4C8S/gjFYiWUGqKQ53wn00w6mo87IQI9NANTf X-Received: by 2002:a05:6e02:13d4:: with SMTP id v20mr8076360ilj.247.1631539986463; Mon, 13 Sep 2021 06:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631539986; cv=none; d=google.com; s=arc-20160816; b=hARaNlF8Kj4dyrGsiTzbuVX/004ASAGNh+OveXPAZh/nf212imUZarZNHQVwrydIaR V5lb8ELcd1/g5ZTnUgHqEN9fhaffsCLI1SLUhbdwZrxdKSYTP41BKwqhkcoxPLpm6dG6 6jSQdBMUpPIu5YqNs7J5kC4OSkeCzNuT35I6rVGdp8KMOrQyRdQj/Wpxx1bEfZ1T30QF RCQwnVtDn5G15T/OAxxALEuAWXtbQvhUwjD/uxwEOL38usgLdOqDWPpWa54jJBVa62dq GG37HqvLiYf3C5e9xoko8QxyqEmpX80oGB2k1NqANK7otJsF+DJ8aRhYb/zkBHYWpfVU raHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wOE9xw8iabkx0wAw+/6HE42k85U+3Y+IL/a5DybQlCM=; b=YsDRqbH+1O3AMxOwHgGBHWc4MxnAX7GxzoVKFEnOi8aLZKiD6w61TK1ARp3zI/HGlc f/GkWNw+tN5axWxlIgVwFlLyCiGfBd3a0vEjcleglBh6rzFUb8LwPK1xZrmx5pxSTUbD Y1OJZlB+84gPZij7xWsAifwrbOIJZWO2moFkhK9KGMlQXDryNPeG5bNw6rcJzJpjwylR 6A+ONccKP3thrncXXMTQ3rmqVZBFAdyP5AvPamvBzBwgYH1GLAMEaUMzx2zcNyfxNPaP coLX/F+X/AIPoGBHHPUArKfrWTMcblLIaf+g1JXLebj2xCDAzvAWcmnB0wnpYIRolrQH Mifg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MaENfQJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 192si6302429ioc.91.2021.09.13.06.32.51; Mon, 13 Sep 2021 06:33:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MaENfQJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239894AbhIMNbU (ORCPT + 99 others); Mon, 13 Sep 2021 09:31:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:35044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240132AbhIMNT4 (ORCPT ); Mon, 13 Sep 2021 09:19:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76696610FE; Mon, 13 Sep 2021 13:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539063; bh=dd0+vEyGnn4ll4F9/tTk78sT6GA7/5zJigxaZ8m1hmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MaENfQJllYIeDpiYz1bnHiWafU1ywsOK6tRNmsts7IeAw6pEaoEzhMjs9/2VEoNp8 lBvqmO5wdufGj2eMJZDoyhIduRAM1oTsvYwYFiEOckgT1zmlj83M+CG9aKJQNJIQDs UXaiPFuLakPAlk/abCZGUWK73etAOFHMLtil++m8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Weisbecker , Thomas Gleixner , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.4 009/144] posix-cpu-timers: Force next expiration recalc after itimer reset Date: Mon, 13 Sep 2021 15:13:10 +0200 Message-Id: <20210913131048.279520152@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frederic Weisbecker [ Upstream commit 406dd42bd1ba0c01babf9cde169bb319e52f6147 ] When an itimer deactivates a previously armed expiration, it simply doesn't do anything. As a result the process wide cputime counter keeps running and the tick dependency stays set until it reaches the old ghost expiration value. This can be reproduced with the following snippet: void trigger_process_counter(void) { struct itimerval n = {}; n.it_value.tv_sec = 100; setitimer(ITIMER_VIRTUAL, &n, NULL); n.it_value.tv_sec = 0; setitimer(ITIMER_VIRTUAL, &n, NULL); } Fix this with resetting the relevant base expiration. This is similar to disarming a timer. Signed-off-by: Frederic Weisbecker Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20210726125513.271824-4-frederic@kernel.org Signed-off-by: Sasha Levin --- kernel/time/posix-cpu-timers.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index eacb0ca30193..30e061b210b7 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -1201,8 +1201,6 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid, } } - if (!*newval) - return; *newval += now; } -- 2.30.2