Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp789715pxv; Thu, 1 Jul 2021 09:15:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoXR0iRjFzFFm5Rvac0/q92sQqZg951RwQWd2fubyudU6a+fhzI3otG8+Y/3IEX3HUJ3+p X-Received: by 2002:a17:906:cb81:: with SMTP id mf1mr676768ejb.199.1625156124759; Thu, 01 Jul 2021 09:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625156124; cv=none; d=google.com; s=arc-20160816; b=aAhjfshQbar+IAQmffhaRuRhk7ZTCtdXRXuV02nog4YDQij2J4dV1pFrVC2xfjhubY xkwMl563aa72rAbVukZ7NDZitFha1cqXPN8Lk7Ejg/6CcN4Wbt/AQ1+D709sD5n88iXD uFNQ/+lncDYyc7gzgZnnGadGW0/q8KDA/ARNnVaOho0LKotYyLqhgpc2EdShfwX8N2CL UC0Ehycz6oqLqiLxW+WWm0RCgaGP4v5+R4XcxkoizTtyq6TmKZpMC1O5hEyF5MLY7EBL W7GHxMPw86odmuyuopL8qqS+cNYMmtvhYMwxXT7+i52zyfW2xTXDbkq+755znY1hX38a PRyg== 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=SDYozNhStxAiY5qNPydI3RWJmmOM1sqq31q5Qa3cOzY=; b=AvWuqt/w4DQ/VTdoyhF0gSMVkNUuazbeAYnUG4l6MXuvQbkFgQqWyZ2OTmyd6ZnJu9 iCx+rArsYnUK+/J4/m7LUrn6KaqAnKiUxUOYXCDtAjVCiBdWeJVqlQdQLkJyyvD1c1Qq gXPTgCwLeEM/K7IMT5uBd/100kT2tlHiSkWP+tUUMqV0d+WyontbkVXPLQC58l6Y3zEL Nsn8exTtlS8W1zDBzL+ufgexV007HtXAZhregs+uu4EgXFt9XJ7r/9sqQFFV1FkpKt2Z 0icbtTVRUZHcPMjWB/KalWiiDSb+EXSn4LRE4F+Rmq0OPui4aLJpv2ZK44wJ9+Q3JOkT pfkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Tl/in+5M"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id og29si302060ejc.393.2021.07.01.09.15.00; Thu, 01 Jul 2021 09:15:24 -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=@infradead.org header.s=casper.20170209 header.b="Tl/in+5M"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbhGAQQG (ORCPT + 99 others); Thu, 1 Jul 2021 12:16:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbhGAQQG (ORCPT ); Thu, 1 Jul 2021 12:16:06 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2AD6C061762 for ; Thu, 1 Jul 2021 09:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SDYozNhStxAiY5qNPydI3RWJmmOM1sqq31q5Qa3cOzY=; b=Tl/in+5MjOSyzhrg3caYBLA1QJ pXqrzT+tleAKq2Y4y7XL4dVmnkVIScDKePPTW3vdoRJdHPHjJb769SAKleZLc4wW7yamWj+4NQA80 DVWwjfIyCmLoFQ11nAAjl+jeLZZw6qV8y6bhUcZqeAKmSfhMDOMQYRl7Q/IBk4yJMdCGP3L7SiAf2 KWbZJYTXEvICDdBMBas+KnibM/3KKTuAH4qgZET5MoqFBiZBtvA3Bph5L83/fPTVOCZ2I6VNMnxSN 4zkKnNwjjiEN9fAFZ3355o167BAz0K69PgoriDeblma8xsO5vi7dXgAM/LXaTC/PcQ4pxwq5Kyz7D aOy75pvA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyzII-006kbX-TP; Thu, 01 Jul 2021 16:12:06 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E69E3300067; Thu, 1 Jul 2021 18:12:00 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C481920198B95; Thu, 1 Jul 2021 18:12:00 +0200 (CEST) Date: Thu, 1 Jul 2021 18:12:00 +0200 From: Peter Zijlstra To: Suren Baghdasaryan Cc: Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Benjamin Segall , Mel Gorman , Daniel Bristot de Oliveira , matthias.bgg@gmail.com, Minchan Kim , Tim Murray , YT Chang , Wenju Xu =?utf-8?B?KOiuuOaWh+S4vik=?= , Jonathan JMChen =?utf-8?B?KOmZs+WutuaYjik=?= , LKML , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel-team , SH Chen Subject: Re: [PATCH v2 1/1] psi: stop relying on timer_pending for poll_work rescheduling Message-ID: References: <20210630205151.137001-1-surenb@google.com> 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 Thu, Jul 01, 2021 at 09:09:25AM -0700, Suren Baghdasaryan wrote: > On Thu, Jul 1, 2021 at 1:59 AM Peter Zijlstra wrote: > > > > On Wed, Jun 30, 2021 at 01:51:51PM -0700, Suren Baghdasaryan wrote: > > > + /* cmpxchg should be called even when !force to set poll_scheduled */ > > > + if (atomic_cmpxchg(&group->poll_scheduled, 0, 1) && !force) > > > return; > > > > Why is that a cmpxchg() ? > > We want to set poll_scheduled and proceed with rescheduling the timer > unless it's already scheduled, so cmpxchg helps us to make that > decision atomically. Or did I misunderstand your question? What's wrong with: atomic_xchg(&group->poll_scheduled, 1) ?