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 E9234C36010 for ; Fri, 4 Apr 2025 19:01:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DE6A6B000A; Fri, 4 Apr 2025 15:01:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 08EB76B000C; Fri, 4 Apr 2025 15:01:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E48B86B000D; Fri, 4 Apr 2025 15:01:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C5E906B000A for ; Fri, 4 Apr 2025 15:01:14 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AD200C074A for ; Fri, 4 Apr 2025 19:01:15 +0000 (UTC) X-FDA: 83297279310.24.E1C8081 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 3A3C840012 for ; Fri, 4 Apr 2025 19:01:13 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=U7Lb+Iwg; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of llong@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=llong@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743793273; a=rsa-sha256; cv=none; b=feji06S2MAK7v0KK7+uVfVB0aDD/uKKwbtB21DWN86mdQHZ3hFgAOWPUde1WNflmuyujnX 4jde27vP8mUhZ81p4KbcLp1yN8dKYUKpXGILs96fzmMRc0ThesfU6uVMZj8rKVgRXdI9X/ 0H8YCwcEpXwXtwDtG+xmut7qXnWQvbE= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=U7Lb+Iwg; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of llong@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=llong@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743793273; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G1MMtNiDnolUZJhUSU3/9gDr+oQodav3erGGx1lsb/g=; b=mfBE8k/IcR7hDt55H8FEaWaNIhwkvExHsR+qTWkj2KI+F7efkzB4sHiWKVwzjyjWezLUrO ygROQnSAXh5nsYee8hf7EYEHucM2Ipm6SCs1PzgwNvWrk2VsDw8KzDAeblirYTh3CK6qzp UICFK3ZrZEExB8wXqdDbfsvMP0NnDRs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743793272; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G1MMtNiDnolUZJhUSU3/9gDr+oQodav3erGGx1lsb/g=; b=U7Lb+IwgoZcvNzYQeDeOOAsNpyQOGmYNu4zt+HP7JJfZ9aa8aSGu3KXFXXjhFNblrHSi67 uSzXCCXnE7MpUcqjavk3rrzkrrbJb/ISgs6Ljy+Bkq6SBe6I5tGcgVBk8QMojAoG5nKVxV kwI6nyE0VcD8NITbPZ3AJVvhbUIMNpo= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-182-YNAPBMP1OTiiqraAm1DzrQ-1; Fri, 04 Apr 2025 15:01:11 -0400 X-MC-Unique: YNAPBMP1OTiiqraAm1DzrQ-1 X-Mimecast-MFC-AGG-ID: YNAPBMP1OTiiqraAm1DzrQ_1743793270 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7c5c77aff55so551379585a.3 for ; Fri, 04 Apr 2025 12:01:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743793270; x=1744398070; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G1MMtNiDnolUZJhUSU3/9gDr+oQodav3erGGx1lsb/g=; b=YpZ20W8J+JpcnGEgwc1PV8luOp7KduUvP9BMsu58AilNEToiGfU5babk0xDnhAKrN+ pBjC7yNfEvwwY3dVZIi1xLGZ8A6tP5QwqofQZIwtN4kegbKESUuf52TnTvVHd1SsrZqu lFRaP8Zw03xOTWLY6Kdz/hqwQHINj37WKPE89FftbsGM9Q+GH3CCQNPYZq9hwL2oWtFg Jkr3rPj/izgFm/Mrn5I/qgKs+BAYXKCt0AuXl54Hs1nbUtUCPkCN46YK3gCj9l0TCTz9 L1PKvZUjnTzhJu94g0QRrtu453B+RA1tfkaHjjq7zjf92RDINHkIaUCcKU2/2GCCNUJX lpwA== X-Forwarded-Encrypted: i=1; AJvYcCUWHFaA3uoQuK8/BZ0enw5K8qLE9OTKmqN3tOmxWEU8eLXQgEiUVxSBwDmY4x0bk3KXfA4DMw4xrw==@kvack.org X-Gm-Message-State: AOJu0Ywh9aih7FLK8PDFVXMJ5lkUIIY1Ws8hIFYvkr5RzlVuOOuXgvUB 7H0tcQ5pZlL7ti6V1eNhRvqjfkYhDvURzi6zGnYLSxR39Zz7TBNtM1Hf5o1SwERrnjOvNLcafD8 qUSwuj/ggDX+E9jAjW6SLWfw6zVUwtJHpMH0NLbq6tEehKOk5 X-Gm-Gg: ASbGncsWN9mjDSDsKtiU0MIk5aIzYmlZqjKvV9kfiFL52VxuvVG1zbd/Px2TUlQar/1 rviJbmTaS3FjZzj/llZojGEipcazZhfnrtccUKKuI/lTZg43cu8H0mROD0Sj8cifUTlfD4Ccyol JYaUY0mORLjnmQwCqAtiWAoWxlgDTCG2IJ+enyGK6yr6zBUsIdsiG4evtfgSZB6FtzVH5JILUsr 8u/dNJRzPlhJ6ih3FDxOt7VQ/rXo/hqe39p9hkLFTXOM7hw+GCeBPstarq9uqyRX/XM9bm1QvrY /kswya4Jw3dmvT7w+4bX3HPdw72pzjgbvVyif5ZqenvBoEll70pjCI1d+QXqOw== X-Received: by 2002:a05:620a:2846:b0:7c5:3b8d:9f34 with SMTP id af79cd13be357-7c774d71e83mr623397385a.34.1743793270580; Fri, 04 Apr 2025 12:01:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2pRizqiBzi0bsE2Dny26nsl1JiAGoprEnqGYgEVCSGkEWDheGOUcCAScM0Ciy8R9ST8/yug== X-Received: by 2002:a05:620a:2846:b0:7c5:3b8d:9f34 with SMTP id af79cd13be357-7c774d71e83mr623393285a.34.1743793270255; Fri, 04 Apr 2025 12:01:10 -0700 (PDT) Received: from ?IPV6:2601:188:c100:5710:315f:57b3:b997:5fca? ([2601:188:c100:5710:315f:57b3:b997:5fca]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7c76e5dc169sm255423485a.0.2025.04.04.12.01.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Apr 2025 12:01:09 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <89775280-c702-48cf-b430-07231759a8b7@redhat.com> Date: Fri, 4 Apr 2025 15:01:08 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] memcg: Don't generate low/min events if either low/min or elow/emin is 0 To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Tejun Heo , Shuah Khan , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org References: <20250404012435.656045-1-longman@redhat.com> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: F4-AxzWyOawKltpzHV5N9z9DKS97ILMFkPi0HqYSCmA_1743793270 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A3C840012 X-Stat-Signature: 81qdpnoer9q9jzc8gwquqmo45t46z5oz X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1743793273-865211 X-HE-Meta: U2FsdGVkX1+/2pycy0/EAUWWNoVq513PmD6nXavMEBDT5EnYQFsegOph2NpQFwmJNVlKFcvJH/iihlIJTLk7MU4h3vWtGXAiYkAsM9ydgL0GcmAy3HHg2eZLyA0m7tSHt+CQJElEsG3jqhy7hRVdAa+xoHtwyI+ZdOxRyYNpnIfM56yImW0I0T92c9W31I+j1BfcktqfOF+9xLox8yPVJID2WQ28kN9KOYhWsVmIsl4qUuhsXa1WCzvxhTCCmwIJTU0ONpaRzbFglxYqEH78ksV8WQsC1YraKSgAp/jSVfHJ2ecMCTOr9JEEOQMV003Xn8lxmuv5EmAXKUsV9AaF9Bn+4OrEZQ6J6t/H8tXUEsD6HKTH6ati5hja7MvxSUjeM0gBWQj+/kr6L/SzGPA75SC34hXBaZC51IEdXnpiLUda6hC3T45dtgOS7cGluxMZ255UooWx2/srYM/vKVIE121n73hvYzB+jHfz7Dt7INEEWDXZ6zJeSURvBDBQi1hsjFwwUxUZ2Fo/0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m@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 4/4/25 2:26 PM, Michal Koutný wrote: > Hello Waiman. > > On Thu, Apr 03, 2025 at 09:24:34PM -0400, Waiman Long wrote: >> 1) memory.low is set to 0, but low events can still be triggered and >> so the cgroup may have a non-zero low event count. I doubt users are >> looking for that as they didn't set memory.low at all. > I agree with this reasoning, been there [1] but fix ain't easy (also > consensus of whether such an event should count or not and whether > reclaim should happen or not). (See also [2] where I had tried other > approaches that _didn't_ work.) > >> 2) memory.low is set to a non-zero value but the cgroup has no task in >> it so that it has an effective low value of 0. > There maybe page cache remaining in the cgroup even with not present > task inside it. For the test_memcontrol case, a cgroup is created but no task has already been moved into it. So the memory usage is 0. I agree that if a task has ever lived in the cgroup, the usage will not be 0. In that case memory reclaim is certainly justified. >> Again it may have a non-zero low event count if memory reclaim >> happens. This is probably not a result expected by the users and it >> is really doubtful that users will check an empty cgroup with no >> task in it and expecting some non-zero event counts. > Well, if memory.current > 0, some reclaim events can be justified and > thus expected (e.g. by me). > >> The simple and naive fix of changing the operator to ">", however, >> changes the memory reclaim behavior which can lead to other failures >> as low events are needed to facilitate memory reclaim. So we can't do >> that without some relatively riskier changes in memory reclaim. >> >> Another simpler alternative is to avoid reporting below_low failure >> if either memory.low or its effective equivalent is 0 which is done >> by this patch specifically for the two failed use cases above. > Admittedly, I haven't seen any complaints from real world about these > events except for this test (which was ported from selftests to LTP > too). > >> With this patch applied, the test_memcg_low sub-test finishes >> successfully without failure in most cases. > I'd say the simplest solution to make the test pass without figuring out > what semantics of low events should be correct is not to check the > memory.events:low at all with memory_recursiveprot (this is what was > done in the cloned LTP test). Another alternative is to modify the test to allow non-zero event count even if low is not set. Cheers, Longman > > Michal > > [1] https://lore.kernel.org/all/20220322182248.29121-1-mkoutny@suse.com/ > [2] https://bugzilla.suse.com/show_bug.cgi?id=1196298