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 8D9BFC64EC7 for ; Tue, 28 Feb 2023 13:50:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D648F6B0073; Tue, 28 Feb 2023 08:50:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CED7F6B0075; Tue, 28 Feb 2023 08:50:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8E876B0078; Tue, 28 Feb 2023 08:50:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A5B556B0073 for ; Tue, 28 Feb 2023 08:50:57 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 68AD2AB0E5 for ; Tue, 28 Feb 2023 13:50:57 +0000 (UTC) X-FDA: 80516836554.30.C138FE5 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf20.hostedemail.com (Postfix) with ESMTP id 3C6621C0002 for ; Tue, 28 Feb 2023 13:50:54 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=IYQKcMF4; spf=pass (imf20.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677592255; 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=a+axJ4fDmePQKpl5oDQ9xI+mAYeRUk3jBZn02hzcYwk=; b=2MgWVfqq687UMsvhJ4heQ08QGoX/ffU8qnPdkD4Yh/1qoqy5oX54sWOxeH40eKIS5vtAwL 8EQM1PvLCkgrRtErs0nJ9rqmIS/Ro8H88LLIy7ZiRPebx/SaQwxXJjRjpU2u8k+hJueU/b RJvVlTswydCTJs9AWHou2tvkggwclOc= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=IYQKcMF4; spf=pass (imf20.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677592255; a=rsa-sha256; cv=none; b=brTr/yzETlKj2yFBs+BUhWXmS2iFWkJO034MU0IaujtWtW+elpMsQ81Alrg1XwKtL5WkuR k1Cqpg3wEAD+BFIPxJh337abvYEb52Fjog8Mg5wrKtLI74MN55uyHOm5YT+HMrlRO9hnNF 4bGOTw6VfDptVkMyfoKeDn4UugDtxt4= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9FA681FDC1; Tue, 28 Feb 2023 13:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1677592253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a+axJ4fDmePQKpl5oDQ9xI+mAYeRUk3jBZn02hzcYwk=; b=IYQKcMF4XvBnvvKRj/q+4NsA4zlgvalUeOeZo1lBfkaF3u2BNeUHa15J5mK2wKQUGa2QzL 7DHSTLBQQX4mHTOkhneDNjY8k6kwgvqUD4TOa2szu510WQDdc/g+V5bXW+oLqUMQDQCzLK //rYSrtyAx9tgv/KUWmg5yxRdrZunok= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 798E913440; Tue, 28 Feb 2023 13:50:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id jU5ZG70G/mPKQQAAMHmgww (envelope-from ); Tue, 28 Feb 2023 13:50:53 +0000 Date: Tue, 28 Feb 2023 14:50:52 +0100 From: Michal Hocko To: Suren Baghdasaryan 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 Subject: Re: [PATCH] psi: reduce min window size to 50ms Message-ID: References: <15cd8816-b474-0535-d854-41982d3bbe5c@quicinc.com> <82406da2-799e-f0b4-bce0-7d47486030d4@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 9m85yzzpknoq56jxozhng5umf4dqj5ej X-Rspamd-Queue-Id: 3C6621C0002 X-HE-Tag: 1677592254-723293 X-HE-Meta: U2FsdGVkX1+055ya5sm805pkm81sG5MCCrK4wioR8QhPY7aQyT3YD0Bd69zMknpVlr2FxQyubmDJJWxJ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YhZWFU1cUxDhC4eA1WRwy2jMetgyzBGE/EtbDjJ1/xMSrsBXiS2xN2oLDRDQXEEF 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 27-02-23 11:50:48, Suren Baghdasaryan wrote: > 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? That is no different from any other part of the workload running within the same cpu bound cgroup running overboard with the cpu consumption. I do not see why psimon or anything else should be any different. Actually the only difference here is that the psi monitoring is outsourced to a kernel thread which is running ourside of any constrains. I am not sure where do we stand with kernel thread cpu cgroup accounting and I suspect this is not a trivial thing to do ATM. Hence longer term plan. -- Michal Hocko SUSE Labs