From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCF7FC48BE5 for ; Wed, 16 Jun 2021 11:21:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C4C661356 for ; Wed, 16 Jun 2021 11:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232111AbhFPLXV (ORCPT ); Wed, 16 Jun 2021 07:23:21 -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.