Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp741891imm; Wed, 6 Jun 2018 05:24:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJeKUzhB1UF+5lUquIhdx5yQz+st0WmdhPvViJ3YxIlTuJbEvoRR92gNoP5NABdlOhJWhsx X-Received: by 2002:a62:418b:: with SMTP id g11-v6mr2258601pfd.51.1528287891428; Wed, 06 Jun 2018 05:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528287891; cv=none; d=google.com; s=arc-20160816; b=SbBPbWGLGldYghrg/KTdJkiASTZqImCOhg7UVwf4XAXnHiiQ6rAy9CdU74NXEkgXSq SBgwSFJ/HBNh95vyWcBsAirgEN1QkhgnCtw2BJMLzmPkllpNvGAGunPdRJSMSBKNalS9 pxzO2tLw/PKcS/K0EYl3EJkPS5qNOBo4XbDVWjIoY4lfkXTvLICOUH5b9lYkpXdO7cue EKinGOe5w5gOSiZY63HAV+b3pgBSr7nMu+KPCrnMtfhbku8aWOkfY1jEgtk8++1cj1cn EiFDVQ7mDFDQkJNdgD9gz7Uu1V3hNRve9DNz1JA0eMOeyU6CnBYPCLPI80igA3RuUxSB 8CDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=vvINCo9vuHb9Luh3h4TTVw2etBcD5u8PJTGdlb0Ezl0=; b=0R/jjSn+uRJs2tHSvvvPPZNDRemKp/XhDn0IFa46Ug2/P58ScpczEXyU42zmp5bzQu Nt/+sCu4qezivwLzgLEf7LkjUQ0t/YUv/cd9HDz6HQiQtYbJqtZsdrmIFLKlfE5M68ox 0ei/kd27O4EYVWRAxUINCLcysnLEGvN8D62v/diVq3MEYY0obGkJa+ONYDPr5eNzAgLF IGfdf1PfrF8vS/siZpuH0MJfnln+45UxyDpRmL4k13TI7pPQMHl9NTmW9gVZylumjT77 IBTJKXuL+6Fu4Gvb0eHrjX27mOY8gKOiU9j7f4XZ4YMehcfhlF2l8wdcevDdgBt2QTjs e8Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Do0jtmHy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24-v6si10710088pgv.658.2018.06.06.05.24.36; Wed, 06 Jun 2018 05:24:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Do0jtmHy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751980AbeFFMYE (ORCPT + 99 others); Wed, 6 Jun 2018 08:24:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36130 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751516AbeFFMYC (ORCPT ); Wed, 6 Jun 2018 08:24:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=vvINCo9vuHb9Luh3h4TTVw2etBcD5u8PJTGdlb0Ezl0=; b=Do0jtmHyB9Y/KaCZA00j6FFWF TpDpL+kMVgAtzVWMhQV2jpghvs4YbsIDvDUIP1kvQJihZdRt9aQ+IZny7QMyHzEi2iVhUV0S5BRNs 7UuAcId9lqnd8SxXFS2B34guTdLWXj265YZLOlm2ujp8E992vrFcgONhS2snW/iBzYzCz1lO+c6Rh C0AHDj7lzsHBAmQzYPRq3ZG5zIhumZopwBOljU3HIBM2CdtBlh8LNDD8Jd1f51guFxyfYy8Qg2glR w91of4FgIQE+ebii3/FOmhVQNQSj+zDtMLh4PFSXay96CfCWNG7+uEUWKa4kWVRrmdB2/bD1dCEhm Sm5MCnWYg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQXTs-0006LO-4e; Wed, 06 Jun 2018 12:24:00 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BCCD4201EA7AB; Wed, 6 Jun 2018 14:23:57 +0200 (CEST) Date: Wed, 6 Jun 2018 14:23:57 +0200 From: Peter Zijlstra To: Daniel Lezcano Cc: rjw@rjwysocki.net, linux-kernel@vger.kernel.org, Viresh Kumar , Eduardo Valentin , Javi Merino , Leo Yan , Kevin Wangtao , Vincent Guittot , Rui Zhang , Daniel Thompson , "open list:POWER MANAGEMENT CORE" Subject: Re: [PATCH V5] powercap/drivers/idle_injection: Add an idle injection framework Message-ID: <20180606122357.GN12258@hirez.programming.kicks-ass.net> References: <1528190208-22915-1-git-send-email-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1528190208-22915-1-git-send-email-daniel.lezcano@linaro.org> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 05, 2018 at 11:16:40AM +0200, Daniel Lezcano wrote: > + atomic_t idle_duration_ms; > + atomic_t run_duration_ms; > + idle_duration_ms = atomic_read(&ii_dev->idle_duration_ms); > + run_duration_ms = atomic_read(&ii_dev->run_duration_ms); > + atomic_set(&ii_dev->run_duration_ms, run_duration_ms); > + atomic_set(&ii_dev->idle_duration_ms, idle_duration_ms); > + *run_duration_ms = atomic_read(&ii_dev->run_duration_ms); > + *idle_duration_ms = atomic_read(&ii_dev->idle_duration_ms); > + if (!atomic_read(&ii_dev->idle_duration_ms)) > + if (!atomic_read(&ii_dev->run_duration_ms)) What is the point of atomic_t here ?!