Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp379041pxj; Wed, 16 Jun 2021 04:43:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLHx0oTrm8H1mD0dd7Fb97NLie3UpK2LTLtXQtPixOngloU2GGX31SzfMJWmLPQkA6MQt6 X-Received: by 2002:a05:6602:1304:: with SMTP id h4mr3221367iov.180.1623843816978; Wed, 16 Jun 2021 04:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623843816; cv=none; d=google.com; s=arc-20160816; b=qGZdMObJEtYV8ipmfwnrNcTEfpjGPzQNY0v9r1edvPhM3VMIXgMqwPnebjZwPGEtch zqlFEBuulUVd8WYHQzj2d1aDNYYDELaNGj43HC10J4MFidDpOZx+G9s50EBCjSUEwFxw dDJWLxnuYKGWz2h064HxslI4CoY3qE/g1Rc6YntwnuA5Z/cLOKpPAwPKpLkCoLcegYl/ YMRIifDx6bB8C9kmhiAecbmZkt4JOgSG1XTDPH65k7V7hx1rLWN33oxM/0WP8TuUd4Go r2sxfJRlbAq+Shmo/BTWRg3731UEJO8gVz6B92tB4LONW4pgwC3Z5acXjOCqp+8PXMrK bsVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=APM6DOVqBYQAC1gMQtQuLZTR7HQg+NnHHOYmewLtsu4=; b=tKmUM6vIijxg03MOpTwxCEMjyYZ/2M6Rf8FTe3F6ZsB0AljlVQJ17oFjkf1ASxywkJ BDxB5qNMUQy9YwrKHgjbs11CY/vjonKbOvaolWOfvcUXj0xfZdCHXfPTTGBTUJwiPLn2 N3jw4O5HPClMfaxpcggUBL9X1BQ0FL99JsKmBU8/vKPidhLEJBcZB0+oXPHPcYkFt4C1 IHqN+ke7Ze12+U8z25kX9Ljc0AygrqnTM3DoGwW10FigcOxxko4rr0qaEgZ4jWBH6ZSU Yee1Pz9EfrB7NVHyNcDEiRIwC9KO2tILsZ6RP+wlRVWpFplBIeWWhxWQ+u1Itz1RBaOV J3Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HA9Ms00c; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o20si575133jat.73.2021.06.16.04.43.13; Wed, 16 Jun 2021 04:43:36 -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=@kernel.org header.s=k20201202 header.b=HA9Ms00c; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230409AbhFPLXU (ORCPT + 99 others); Wed, 16 Jun 2021 07:23:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:34440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbhFPLXT (ORCPT ); Wed, 16 Jun 2021 07:23:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9DB4C60FD9; Wed, 16 Jun 2021 11:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623842474; bh=YdjgUjBaT0kve1VcxN31dA7LhzfhUzdoudAHkw5AaqE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HA9Ms00cnU8pXS7QUZCj+uoeHyHjhftHber6nYSPZH1UCO5+UuoFljikN2VfjyDne bmXYXWPnKqjKzobwz9whZ0MNgMncvOlHofInWZMSNFTBilwJP/I87NdnDhUDFGrdAj o3SI64rHJQUvjtu4QjlAWjEPG8bD9fzPPn+SZNFpp81AXY02+Y4c77TNSn3MBF+0C4 o78jUVvR8nwBumdS/97TZEL1iPwtdnX8ZhPqxXoS7HV8oUx6+8kmIMmoikXznDG0v1 e3D8JzpvmHYD6H+GFYAWJhVNx28lUPHxlng0sYs+oS5c/pAKxUPQ9OrTeOgrF8qsOS heI7L6JOs8srw== Date: Wed, 16 Jun 2021 13:21:11 +0200 From: Frederic Weisbecker To: Peter Zijlstra Cc: Thomas Gleixner , LKML , "Eric W . Biederman" , Oleg Nesterov , Ingo Molnar Subject: Re: [PATCH 4/6] posix-cpu-timers: Force next_expiration recalc after timer reset Message-ID: <20210616112111.GB801071@lothringen> References: <20210604113159.26177-1-frederic@kernel.org> <20210604113159.26177-5-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 11:23:33AM +0200, Peter Zijlstra wrote: > On Fri, Jun 04, 2021 at 01:31:57PM +0200, Frederic Weisbecker wrote: > > > @@ -647,8 +651,6 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags, > > if (unlikely(timer->it.cpu.firing)) { > > timer->it.cpu.firing = -1; > > ret = TIMER_RETRY; > > - } else { > > - cpu_timer_dequeue(ctmr); > > } > > > > /* > > @@ -713,9 +715,13 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags, > > * For a timer with no notification action, we don't actually > > * arm the timer (we'll just fake it for timer_gettime). > > */ > > - cpu_timer_setexpires(ctmr, new_expires); > > - if (new_expires != 0 && val < new_expires) { > > - arm_timer(timer, p); > > + if (new_expires != 0) { > > + cpu_timer_dequeue(ctmr); > > + cpu_timer_setexpires(ctmr, new_expires); > > + if (val < new_expires) > > + arm_timer(timer, p); > > + } else { > > + disarm_timer(timer, p); > > } > > > > unlock_task_sighand(p, &flags); > > AFAICT there's an error path in between where you've removed > cpu_timer_dequeue() and added it back. This error path will now leave > the timer enqueued. Ah that's the case where the timer is firing. In this case it can't be queued anyway. Also it's a retry path so we'll eventually dequeue it in any case (should it be concurrently requeued after firing). Thanks.