From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29F2FC64ED8 for ; Mon, 27 Feb 2023 17:50:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA2656B0071; Mon, 27 Feb 2023 12:50:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B52076B0072; Mon, 27 Feb 2023 12:50:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A41DD6B0073; Mon, 27 Feb 2023 12:50:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 90E136B0071 for ; Mon, 27 Feb 2023 12:50:15 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 108DF80AB1 for ; Mon, 27 Feb 2023 17:50:15 +0000 (UTC) X-FDA: 80513810790.28.F02E80A Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) by imf12.hostedemail.com (Postfix) with ESMTP id 55D1C40018 for ; Mon, 27 Feb 2023 17:50:13 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=PiMWHRJU; spf=pass (imf12.hostedemail.com: domain of surenb@google.com designates 209.85.128.175 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677520213; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NoJU+P+wk0oP4uOQVAulVzE7C+CLPILBxmnJLRQCZ04=; b=NTWjAwIiKbD9LMFeR19i1PROZ7u4pnlx1KMnKHVXl/zksVohB0IXmD8oRpMZyp64BaI4JC Qc9A/cDbMrBQIEb3Tx6i74rIRLL+pAQBUIuhdblZP8p6yOY92wBzGJyBaQfG7GDmWtY3as yDB4XcPNGeLTxpSvBBMcrbBDki3d3WM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=PiMWHRJU; spf=pass (imf12.hostedemail.com: domain of surenb@google.com designates 209.85.128.175 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677520213; a=rsa-sha256; cv=none; b=4xItBp8XmWDaWZ2gc8Zkvs7ppJzkA2aH5vNDyVbpr5KxBG+ID9KwfDy3cTRq0UJybe2OP0 AcVg3tr6d20IbH/BndgU2UgOODWzTxrid1e95IhaDDNs5pquN0RmmdE5LA7cYHuPddb2R2 dW2vcV32ZkniD+tlZZT6fLYoiDI0M3M= Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-536bf92b55cso197140857b3.12 for ; Mon, 27 Feb 2023 09:50:13 -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=NoJU+P+wk0oP4uOQVAulVzE7C+CLPILBxmnJLRQCZ04=; b=PiMWHRJUpVelTbxf7LJVGiZYvQnIU3y8Qacrg9vzNxq2j3lwg+vo/OZkyZllDmIpIh KIwD10qtsZtlacmxcJAvI+IOxTl2OMd78qzCYpADGpGkbHYgF8JTH1OAJS2gxfaqbva1 Ampsmh7LW/cdt1IMF583Yq0R8mDIK3gD4fFaN5xq9N/CYkmKy57ydA+dWMrW9VQ4K9Vi twbl3C44EY4+K2+vd38kHJQvyew+ugfDirLXryujzn+4EUbS4pNPZQFTd80oBNSB1eOD EhoiujTNyy6Q63JD98dL4xAXk89mwbViAXrxemw1QVXvzvpjnFD0DQZTJ//sW7PGky6h KG2w== 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=NoJU+P+wk0oP4uOQVAulVzE7C+CLPILBxmnJLRQCZ04=; b=BdxMSnweDcuV+3vSO+kjQWk5EtHAZYaMKZfDteYeo2jtQ3QXYqa+M1eSua2jzZizt7 oYsZTXAZpsm9bwzufdJgyHr8wFth3omSt5C2RPHykUDl36gCauM5qYcJ1SUYH79D8veB zPB/H3etEPXLLoGvre6tzAkAGEEE04KaM+SF8oWOleg46n5U3sr4v2YhoFtyQTh3oVk9 VXSNI0UzPmpydAwyud4IfcWw9emYP0aHg/MoCeCNwgJDlO2g+ta3JtSuOoMllHdgA9Yn FDAfIIprYmyp9F96QUVgTsMn824oFbxY+GQiDAuyunyD9vbmxEFoV/24/Y887+D2pCME 8u3g== X-Gm-Message-State: AO0yUKWuFqIGPZgu+sr0IOXC/wPs3XKYMb2qkkcboyisvZK9KlWKKbpr ALnIMFrm6ejGOXxeCYuPFdBaTQWnN2Qo7dBK/2w1uA== X-Google-Smtp-Source: AK7set+AuUEVky3TlKUD481gMrdm00yhbolbqC6ZjtveZ4fmE3p+G7HBX+5fhoi8eN6gwoWKepOXmPldg78dfHdQaV4= X-Received: by 2002:a81:ad27:0:b0:533:9d49:f9c9 with SMTP id l39-20020a81ad27000000b005339d49f9c9mr11022028ywh.0.1677520212213; Mon, 27 Feb 2023 09:50:12 -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 09:49:59 -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" X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 5grxp8jytcoswyeoouz37x9snmjzcqpp X-Rspamd-Queue-Id: 55D1C40018 X-HE-Tag: 1677520213-176406 X-HE-Meta: U2FsdGVkX19t5jtbOU9gWXzXQKToz7Ow+mmB4BwWXcdqnf7VIKRaJEjM9KzgzYO+JxiTMSVEBW+POcypfqOF3HZe+G9y0yZ6TDESCh0kFLFloVzhlLMzszF0Um57uUKdV1DFCnJzKHD48J0vreFxwCovfSkNFeoASCiOyI7PnHjZ8AcR6ChzyGg4w/900XhvnqwKWynk0e5DDu7/Dxyv53R9Hav/klDNxrcHgGg2kYrFDBsE7Lf5AIveoB1Jq4wN+oO/xf1HHIhM5BE3Hq3hzM+joLk9oKtFVzRjd23bZsdfDfdnBf4EX7ojAcnCgsXkBeNXQ0GTUzMcibGhlhm7LIndpnmIYQyT2olt9Ye+ual+pBPWi7oyX5Js3YnLvJRM3jtGHpP3b6qKDw+ez/TTYcOUiIIEfqzwm+3xF23qUza8r7ZdvLfkNKfO1g6x5PfDzmkZLLNyQu22rlMPo5cCziIub/sCARhzY+BXIrENICULYOLpFuxdITWaZEPyTEOZ3g2jDBl0ZLaEjAfc2zfCBsjnjHuXErsh2sePoVVn+MvKz1EIsA8BUDDZRhdi321LCeHeOHsJDodt66e+9sufFgojA3OnHclpZxcmcG3ovwSleJT4rexwyzxJK5EQEfrviqKG6gMHpFtpyx3S7Z5U1/rq4m3E5mbok+h0COgMl/Knnv9yO0t6EtlwVayvUX0K9SUh2IOzMxoqT3BO92/MymPF2WGcrHLa62In/GkaJGvz6knkCTklYz29a2wBR3oyI7Y+rqOnWWDOhkqv2ToRy/tSoHpwf7E84byl7OUyrC1Uiy6QVlwY6CHSE9Z8de4uL8C3l9OUk1l0utWg63vFjb6iX6PgdsMm0yK/F2d3+Oe09L+3nU245g5ZDwh3B62rdZm3z9GuRQBn9byiZACyzNjk6uzZj32OkeMqrP2RGqfACfVDT0cFFovIfiIsPcK+S6nPbxN2CVu7Ea5hYw7 A/OyCh/q uvp56TcLWGmJb6ld5ut6XR7+T5d0Hdum3Qocqbc5+81xZYeftzb3xjq46JuSgg90FSECtjSG8s3MHuleOmqMxMwXtggNK/BYbEwiB0xWmOf/A9fhi+hrwZrXY207U06W6aYNrVZTVZrUHEo389osnC9rsPgufXGnuLPdik3L+Pn+wwVUkC3P50yXL38QWKdQK6HcFLp1iM68WMg50sQYi76cCj4fKzMn7+7sUBdEf7gdbSwt5lOOry+lCIldb7ONdF2A4qoPlqWwKa8WCimLDvCa3V9R/c0JrDT543odM9F03ba7VAlm5q3Z+LzJLKJmfueyfQmrafdx10xlhx/ejwwTfNEXhoN4G7lKRHcAEeWYjL51qPCx4HvFKRNtHgGbQuifn6ScYFeXsWpVaqCUlr52L5W3p+T77JPy7FlYNVBQHzvetI5L6zZVup8TTbXcGb43bptFuvi/sjcesFzKcGGYV2ypgHEgoUu8WXb7AVQCnqJ4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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: > > > > > > On Tue 14-02-23 11:34:30, Suren Baghdasaryan wrote: > > > [...] > > > > Your suggestion to have this limit configurable sounds like obvious > > > > solution. I would like to get some opinions from other maintainers. > > > > Johannes, WDYT? CC'ing Michal to chime in as well since this is mostly > > > > related to memory stalls. > > > > > > I do not think that making this configurable helps much. Many users will > > > be bound to distribution config and also it would be hard to experiment > > > with a recompile cycle every time. This seems just too impractical. > > > > > > Is there any reason why we shouldn't allow any timeout? Shorter > > > timeouts could be restricted to a priviledged context to avoid an easy > > > way to swamp system by too frequent polling. > > > > Hmm, ok. Maybe then we just ensure that only privileged users can set > > triggers and remove the min limit (use a >0 check)? > > This could break existing userspace which is not privileged. I would > just go with CAP_SYS_NICE or similar with small (sub min) timeouts. Yeah, that's what I meant. /proc/pressure/* files already check for CAP_SYS_RESOURCE (https://elixir.bootlin.com/linux/latest/source/kernel/sched/psi.c#L1440) but per-cgroup pressure files do not have this check. I think the original patch which added this check (https://lore.kernel.org/all/20210402025833.27599-1-johunt@akamai.com/) missed the cgroup ones. This should be easy to add but I wonder if that was left that way intentionally. CC'ing the author. Josh, Johannes is that inconsistency between system pressure files and cgroup-specific ones intentional? Can we change them all to check for CAP_SYS_RESOURCE? > > > > 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. Thanks, Suren. > -- > Michal Hocko > SUSE Labs