Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3655638imm; Tue, 17 Jul 2018 08:14:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcT9+QM4FDmu9LsTd3OxYTuWcLeyz3kCs4NDVr/cw5/kT6mVPln3SYkhAUbUMfx1SdxfzRi X-Received: by 2002:a17:902:6b86:: with SMTP id p6-v6mr2032973plk.75.1531840477862; Tue, 17 Jul 2018 08:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531840477; cv=none; d=google.com; s=arc-20160816; b=LxiB5K9M9UJnQh+EhJWvmpMwGQMcx8kHC+GEhlCod06yjWAjbUrtIFACuH7NvwBKEI N1Lj+exDWR3CxFFVl/JPtwOaI7FfvAjAXGBt+3tYnzhW6+0V0QANEaR+YIz0vlPDzpKn TcnHnuI43m/gSwIQgSUbi9LP5AASuitZW+amN9pwyvStH6Bm/vn5HZM/9yYjje96zPWP mT8EPRYlivCljgdF9L6LfBefsTSFjf7X/GsF3DuGBTinXw2m4pRuBmp7D6N5GKf0KEKk 2Sz0/9jYCyynytkWOejVHZ8bTC2lDF6ut3e4VDffiQnP4zADG4Ii4E6cjMhbROGrcRHC xfKA== 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=t9ZAv4duUj3psYRV4CqKfV+SpMBL8ia1fEdGq4TRoS8=; b=NoZCURYH/Wz0MvTjzh5xkf2LCsqhyfUD6XlwmOYiwB/lYiemNY2chhaqaNr1N1NG6J 96YlYbDHZ3jlf7UwhiZ6MnohdXQN4AkJUhpCroCu88L9V7NzUNL+TnQDweQKH3u++8Xf DF+zadyM4+9ZvelVKWEP+x1gl86p8WUccHQ6f2m7Zv+t5c7UXn9EhsEaGDhDwlnmjgJC h4j5dy9iX0aU5iaHUjtUwXh6VnZ0jL1lpBmercRo2jRxaha39uuSff/z/PIEOBzDolSf VXiBcZGFbJICt1ioyeKOONfaNQvJ3Zjkwy1McHiPasZoKDrpjngJKOa+O6kWeyoK/nY2 Eqdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=NmCwbxcs; 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 u195-v6si1107592pgb.443.2018.07.17.08.14.22; Tue, 17 Jul 2018 08:14:37 -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=merlin.20170209 header.b=NmCwbxcs; 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 S1729702AbeGQPqy (ORCPT + 99 others); Tue, 17 Jul 2018 11:46:54 -0400 Received: from merlin.infradead.org ([205.233.59.134]:43914 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729642AbeGQPqx (ORCPT ); Tue, 17 Jul 2018 11:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=t9ZAv4duUj3psYRV4CqKfV+SpMBL8ia1fEdGq4TRoS8=; b=NmCwbxcsh22vR+PAy9YlSa8ft V3EfCNxX/qzkaKCsr8QuGOnIvbdsH0DfZT3nOx+Ud3TFjZdoV4U2ka/Q7B6b8LEZOi+JLS/c4TKPI ARp/6Ij6FVegHxhEFsEAgTlnyWZhzAnq5r84MIcvbzNzGfdIluTtVQmL4Va1+msoEr40vR5l3AXnt jW7G9D8yifj1EmelmNq/jBoBC75SQaAItono+vtEzxaMnEM2eu3KSetWE25nCOQoj6gw5kbze7OF9 E4PEkGWQi2HzajvQJEvG0fXbBn4TeGWcdshJLhLaVUpPHccYoqzLFd6n8wFU0GZxZY48GqH59HsIW k4vAk4/Ew==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffRfV-0001Ep-S2; Tue, 17 Jul 2018 15:13:38 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 835FA20289332; Tue, 17 Jul 2018 17:13:36 +0200 (CEST) Date: Tue, 17 Jul 2018 17:13:36 +0200 From: Peter Zijlstra To: Johannes Weiner Cc: Ingo Molnar , Andrew Morton , Linus Torvalds , Tejun Heo , Suren Baghdasaryan , Vinayak Menon , Christopher Lameter , Mike Galbraith , Shakeel Butt , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [RFC PATCH 10/10] psi: aggregate ongoing stall events when somebody reads pressure Message-ID: <20180717151336.GZ2476@hirez.programming.kicks-ass.net> References: <20180712172942.10094-1-hannes@cmpxchg.org> <20180712172942.10094-11-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180712172942.10094-11-hannes@cmpxchg.org> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 12, 2018 at 01:29:42PM -0400, Johannes Weiner wrote: > @@ -218,10 +216,36 @@ static bool psi_update_stats(struct psi_group *group) > for_each_online_cpu(cpu) { > struct psi_group_cpu *groupc = per_cpu_ptr(group->cpus, cpu); > unsigned long nonidle; > + struct rq_flags rf; > + struct rq *rq; > + u64 now; > > - if (!groupc->nonidle_time) > + if (!groupc->nonidle_time && !groupc->nonidle) > continue; > > + /* > + * We come here for two things: 1) periodic per-cpu > + * bucket flushing and averaging and 2) when the user > + * wants to read a pressure file. For flushing and > + * averaging, which is relatively infrequent, we can > + * be lazy and tolerate some raciness with concurrent > + * updates to the per-cpu counters. However, if a user > + * polls the pressure state, we want to give them the > + * most uptodate information we have, including any > + * currently active state which hasn't been timed yet, > + * because in case of an iowait or a reclaim run, that > + * can be significant. > + */ > + if (ondemand) { > + rq = cpu_rq(cpu); > + rq_lock_irq(rq, &rf); That's a DoS right there..