Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp800594pxv; Thu, 1 Jul 2021 09:30:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy10K49TnueaC1tAGcTCkv+Zdsj+CiajkGZPl6D5TrtVUUdR7Qkki7FiIIzrClAd4qD8jbA X-Received: by 2002:aa7:cb19:: with SMTP id s25mr962790edt.194.1625157005916; Thu, 01 Jul 2021 09:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625157005; cv=none; d=google.com; s=arc-20160816; b=ksAyIsbox9PJa+kDWhn8MAQ4xZS8dlDI4SlHb+2UMjjpeYpWXkpAiNFdE4/uP/KJRV c19kgr/3lX2eRrRjKgXIaYBjrakwg3HI5PnsygRyCnFnhYwTrkx2NaZVVFM1nlmDJHKs 2sy/SJ9cbUtjt+J3svbSYocT6LmrW8AJGD1UPeDtLqGB8oypIm8YHqrib2EsiEnopRG3 Pz4asSklcLHOShhV6ZFQNM7U23vniBNz9IM+GMVN5mCPyIuw9jKyMsPRSosBmMia8W0q CI7iPDpSrXV9Sb+IAI3yzNxub6JChRtyAIR7b8vIKKVWMYkWHtyDDF6XAoevk1ZLkmVp xH7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=jW9usmzYUneRtmPUUy8bPkIeD350ID0dCtIjd2wQbSQ=; b=dUsTdwe3eSgE3yyGsP0DvtCMx7GRCzkL8CGhh5rfWlkGv+EDzP3gGfYFsasMJaQOVw Dbytc/LJSU/hoCDvfsgGzlolqBn0bV6XutdKrJjD6XzhiTIeDoXDeLiQ8mMMQNAmEzXC oU+SQ1NuTRpc3619jlbmS2/MUDRJ6/3sODuM0XHU6PlD37nTWYFBWq92ijBPoob4zvAi CbiR12WECP0pyOC+KTOzfzMNTF2l3uzmkpnobhz+QcQ2bAzmo+LvQu7zZVDUl8B1hYMH 1g07PyebDGjcQ9FBzuVgzdBYoycCnVcrWFO5hysCQiioopPS5YwBiC9HuzoabbcsrZyL dRCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nga6WacM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c6si321809ejc.71.2021.07.01.09.29.19; Thu, 01 Jul 2021 09:30:05 -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=@google.com header.s=20161025 header.b=nga6WacM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232597AbhGAQas (ORCPT + 99 others); Thu, 1 Jul 2021 12:30:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbhGAQas (ORCPT ); Thu, 1 Jul 2021 12:30:48 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 987A1C061762 for ; Thu, 1 Jul 2021 09:28:16 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id g5so11737185ybu.10 for ; Thu, 01 Jul 2021 09:28:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jW9usmzYUneRtmPUUy8bPkIeD350ID0dCtIjd2wQbSQ=; b=nga6WacM6U52NLeH8VpfecsBjtdk02B2lXY37A1ANhERVcUSRWNPMz6NXXu3ZdKE2t xVdbc72ukqInAh1x/3KFXIMHUYfoIQKKBdL5KGYy0xhPAcebSQShwob41BY4D1Y+cTke 5j+IUh/1pu6ZaG5EcbEY0GNJ1EzcNVHbGBcKsftVHSHci4uVb1b+eHBeodvZP7Y9DF1+ 5lIgo6o4dzQFlw/x0ArhoVmeEtpr69uDijMGs04kDukeJ9JE1CrWJ+giAqa3DLFGsNA0 e04uxDISEgnhuWQN7/fF6LoZ7Y7vhbH4HdHYWrTH3RkJLs0GWQvkbimBCcGOqeVPdFOL JZDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jW9usmzYUneRtmPUUy8bPkIeD350ID0dCtIjd2wQbSQ=; b=EQfTE6RcPa3kfIknxIo274F9pZ6nR4y5N3voA6ImsOWjjYYPT3t+NmBLNgKFJLvpni DHkops92muN0/wO1ny90lZTa3tdWdJmpmzBdxCO/BH7LBDMWND6pwLBmgRPh8QrfGDk+ wRD2PzLLD7i2hK9nA5uejHfVMUR45oBX5LEpVGwzRt+q/lj1rxWm1+DCje4Qy3IqU3Br kagGE1wBMgJ2L3axbdtOpAAAZqK0wjIwhltirAy5xByd4Y3ySp79xgCwTl7A8Oicwk/S afNbe3HHInQvgHl+d4Bnn3Q6+tKwWm+/ecTQRH7hqI9IX1qQBwF4JkucTPdgCEwtrxXj 06OA== X-Gm-Message-State: AOAM532QLQnY1Zg+ox1W8B9/lJZjlzsZJ+27iz2yMNVeZz3Iy0klg7Gd SJjsXXiKXr7TjUuh6CrblgoRjtBlbPWP+o1iXpR7vQ== X-Received: by 2002:a25:2e49:: with SMTP id b9mr836477ybn.250.1625156895472; Thu, 01 Jul 2021 09:28:15 -0700 (PDT) MIME-Version: 1.0 References: <20210630205151.137001-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 1 Jul 2021 09:28:04 -0700 Message-ID: Subject: Re: [PATCH v2 1/1] psi: stop relying on timer_pending for poll_work rescheduling To: Peter Zijlstra 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 , =?UTF-8?B?V2VuanUgWHUgKOiuuOaWh+S4vik=?= , =?UTF-8?B?Sm9uYXRoYW4gSk1DaGVuICjpmbPlrrbmmI4p?= , LKML , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel-team , SH Chen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 1, 2021 at 9:12 AM Peter Zijlstra wrote: > > 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) ? Yes, since poll_scheduled can be only 0 or 1 atomic_xchg should work fine here. Functionally equivalent but I assume atomic_xchg() is more efficient due to no comparison. Will respin v3 if the rest looks ok. > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >