Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 746E7C7EE2D for ; Mon, 27 Feb 2023 19:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbjB0TvL (ORCPT ); Mon, 27 Feb 2023 14:51:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbjB0TvJ (ORCPT ); Mon, 27 Feb 2023 14:51:09 -0500 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75ACD25292 for ; Mon, 27 Feb 2023 11:51:00 -0800 (PST) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-536be69eadfso208520497b3.1 for ; Mon, 27 Feb 2023 11:51:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=O4AQL8i6WYgk4Tqy8aH2abmGlvkaKXw9l82KiDgJYLU=; b=lg7t5OPUZDTBohQJEfbPvGoFG001ogATUdvB53bk5UiQW5WldEO+PEfhF+/xN/fNcM nsszBA9qC1GRh3MwWD9mu8DfDE5fppR308TULY8dMifynxJIjZjTxhxwddyUwvu3Cg1I Yqj7rT2Bsp1mBkrPh4iRpgtFj0RpLXhJh6Wv6MekpZbu9rg6Rt3CqKmvqIhNElD3BNtr bTtBxhnia1OtvgsDNTK388pd03hpCTpabafKEesGduip0rWlVoYR7twwJhExF7lmxwBg EJqWsbar50UJyoH8zUyhu1rb+tFr0gLAT/fIoYsgXw00B6+cVQODi+SZmUgcURM9MKkp Nt4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O4AQL8i6WYgk4Tqy8aH2abmGlvkaKXw9l82KiDgJYLU=; b=Lta4WhduEOiZJzEd8RoBJarltoEL6kWCsKTLsRdaH6fq+qJxAlfXNGWEHUez19o1G1 MxQylXMcYxAq83KG+aE6rNz4nN6+Acex+QBCeA0XP8jkjoDCyjstE8f8gId8rz+oRkxw zfQsEqMmFif7PFeZilHXOrRWbJa2xp/wJdp8pOEuFYl4+8cJAsII8SlfCSa2fHWPpI7S RYM9bDmn3U5F69DYCb0Xiud+DukWZizHF9olh4Gd0VKZvXfNPWGRR3XTpBApKCg35y1/ qWLHEyacHYdHavJPldvSEPRILtzjj7rpCF0z5u3tqL2sfIYpVj2wsCgZT5cNXoEQ+boS 8gdA== X-Gm-Message-State: AO0yUKWYbg3MZYequD3yAzsioQ/bwGatPJCpSB1BJU+Lv6lEpm/Y2vkx Q5zeoT+CySUPifni4z8NwarZDHIbYtK81972jFQz6w== X-Google-Smtp-Source: AK7set86i0/5lPLZ/2QOBjjHU2zsxBCTss6LStl3XbSWduyOuC2/0fFBkksQVxbDcf1toTUT5YGwc8/o+Vl+fLjejaU= X-Received: by 2002:a81:b621:0:b0:52e:b7cf:4cd1 with SMTP id u33-20020a81b621000000b0052eb7cf4cd1mr11013161ywh.5.1677527459329; Mon, 27 Feb 2023 11:50:59 -0800 (PST) MIME-Version: 1.0 References: <15cd8816-b474-0535-d854-41982d3bbe5c@quicinc.com> <82406da2-799e-f0b4-bce0-7d47486030d4@quicinc.com> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 27 Feb 2023 11:50:48 -0800 Message-ID: Subject: Re: [PATCH] psi: reduce min window size to 50ms To: Michal Hocko Cc: Sudarshan Rajagopalan , David Hildenbrand , Johannes Weiner , Mike Rapoport , Oscar Salvador , Anshuman Khandual , mark.rutland@arm.com, will@kernel.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Trilok Soni , Sukadev Bhattiprolu , Srivatsa Vaddagiri , Patrick Daly , johunt@akamai.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 27, 2023 at 11:11 AM Michal Hocko wrote: > > On Mon 27-02-23 09:49:59, Suren Baghdasaryan wrote: > > On Mon, Feb 27, 2023 at 5:34 AM Michal Hocko wrote: > > > > > > On Fri 24-02-23 13:07:57, Suren Baghdasaryan wrote: > > > > On Fri, Feb 24, 2023 at 4:47 AM Michal Hocko wrote: > [...] > > > > > Btw. it seems that there is is only a limit on a single trigger per fd > > > > > but no limits per user so it doesn't sound too hard to end up with too > > > > > much polling even with a larger timeouts. To me it seems like we need to > > > > > contain the polling thread to be bound by the cpu controller. > > > > > > > > Hmm. We have one "psimon" thread per cgroup (+1 system-level one) and > > > > poll_min_period for each thread is chosen as the min() of polling > > > > periods between triggers created in that group. So, a bad trigger that > > > > causes overly aggressive polling and polling thread being throttled, > > > > might affect other triggers in that cgroup. > > > > > > Yes, and why that would be a problem? > > > > If unprivileged processes are allowed to add new triggers then a > > malicious process can add a bad trigger and affect other legit > > processes. That sounds like a problem to me. > > Hmm, I am not sure we are on the same page. My argument was that the > monitoring kernel thread should be bound by the same cpu controller so > even if it was excessive it would be bound to the cgroup constrains. Right. But if cgroup constraints are violated then the psimon thread's activity will be impacted by throttling. In such cases won't that affect other "good" triggers served by that thread even if they are using higher polling periods? > > -- > Michal Hocko > SUSE Labs