Article View: linux.kernel.netdev
Article #26811Re: [PATCH RFC nf-next 2/9] memcg: bound memory.high delay arithmetic
From: Hui Zhu
Date: Fri, 04 Dec 2026 07:21
Date: Fri, 04 Dec 2026 07:21
41 lines
10683 bytes
10683 bytes
2026/12/3 10:19, Alireza Asgari: > Hi Hui and Zhang Jiao, > > I saw your discussion about combining the memory.high fixes here: > https://lists.openwall.net/linux-kernel/2026/11/18/558 > > I worked on the same delay calculation in my NFQUEUE RFC. One case > that might be useful for your combined fix is a task with one page of > deferred debt when usage is three times memory.high. At HZ=250 the > expected delay after the final clamp is 500 jiffies (two seconds). > > The case is in memcg_high_test_delay() in patch 3 of my RFC. > https://lore.kernel.org/all/20261115-b4-nfqueue-memory-accounting-v1-3-b9cc30819997@asgari.net/ > > Would it be useful if I adapted that test for your series? > > Thanks, > Alireza > Hi Alireza, Yes, please -- that would be very useful. Your case (nr_pages=1, usage=3x high, 500 jiffies at HZ=250) is a good baseline for the normal path and the final clamp, and would catch any unintended behaviour change from the rework. Could you also add a case that triggers the u64 overflow, which is what 2/2 fixes? Once usage is far enough over high, max_overage * max_overage * HZ wraps and the penalty can come out small or even zero. The changelog's example is memory.high = 1 page with usage = 2049 pages (max_overage = 2^31); the unpatched code wraps there, while the fix should saturate at MEMCG_MAX_HIGH_DELAY_JIFFIES. Asserting the delay is 2*HZ for that case would cover the overflow directly. I've just sent v2 of the series and Cc'd you on it. Happy to review the adapted test. Best, Hui
Technical Details
Message-ID:
<2dfe4f8e-e87d-444f-b3c6-a6acd615013b@linux.dev>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377150-linux-kernel-netdev=dewy.ruReferences:
<20261115-b4-nfqueue-memory-accounting-v1-0-b9cc30819997@asgari.net> <20261115-b4-nfqueue-memory-accounting-v1-2-b9cc30819997@asgari.net> <1a239b2ca50.36a66e22694686.5140051424523797730@asgari.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377150-linux-kernel-netdev=dewy.ru From: hui.zhu@linux.dev (Hui Zhu) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH RFC nf-next 2/9] memcg: bound memory.high delay arithmetic Date: Fri, 4 Dec 2026 15:21:08 +0800 Organization: Usenet Network Message-ID: <2dfe4f8e-e87d-444f-b3c6-a6acd615013b@linux.dev> References: <20261115-b4-nfqueue-memory-accounting-v1-0-b9cc30819997@asgari.net> <20261115-b4-nfqueue-memory-accounting-v1-2-b9cc30819997@asgari.net> <1a239b2ca50.36a66e22694686.5140051424523797730@asgari.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2702113"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:NI3AHPESO5LAOWYbNkuQldsHGSU= sha256:w62QnhwKuzh55okpTCSJJlaMz/ljZ3pAv20wVW4t6z8= sha1:SqmJ/bXtOQR7hq918OsGN0KP4/k= sha256:rVgOErcOoviiC3ziigQXJYaamC42fqTGbveY/Tu9G5E= Content-Language: en-US List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 028C0117B52; Fri, 4 Dec 2026 10:21:58 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.398 X-Spam-Status: No, score=-3.398 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iUFDNAeaY7Z9; Fri, 4 Dec 2026 10:21:52 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377150-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 94D9C117B54; Fri, 4 Dec 2026 10:21:25 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 0AF2525B5E; Fri, 4 Dec 2026 07:21:24 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796368881; b=3dHdPB2OAwieYHfzSZL4V8WJr/g/xu03MxdXDlhn0LkSdlqC2/Ij/h01igqjPLtxp3bP INFa63N9ivNt0eaeQNQlYoag522RaQwP66AmK/IS+nu3H7NatQSHX3f/BHUwlX4ADj8ln DXkSMXR66H0a0N3mvyq4pBuRtCcKm9kXztqo4358BnD+J0Xo1WWHxpUPh6jym4Uyn9LBu jbS+bj/OTBlgHfvPQKrAApA78rydQzyRMHcHscuuVL/N1xMmWyxTpL6DiA3EYsSaeOGJF 11xxM6cOhkJcPskk62KTHEl3IX/QyXAkpSi8YWKkJfqphgY9W3PpwgFDFUaKPQ29oew== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796368881; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=0zvOSq/0M2yTd57kOj8gcpktp0NXonE8SLwXDejid6A=; b=sD6pKTdKkz7HS2G9jBn6/Ec6Hr7PKY6a9dedSMkZ7FaLkpiVzeU1eMzk3xtZh1aGOliQ CykCZGGWisbK/xI8/zabB2X+WVrkgQbwbidG9lZvqfEC8OJdA68QHvml8yPyUn3KrP1x9 LSNbeoVxP8pB0fBGb4TF9rUcbHwmtXBKSXnvwcOmEcarhcAiBfsgct4d6IJzsbXUCagHs mkxs2rW9Zd/CQWfp/jYHzaxuMFH5XBorlbl4jpis2CvuPWrIzFpogxCJ7MAnj/Z2rcuNf tWlGKYGPopnWU5utuIdqrhOjMNlu8y8haXagaikEbLPb7+cJzmJ/bbx3y1+LhlD+hZQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fJsDYLFD; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19070606A32C; Fri, 4 Dec 2026 07:21:21 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fJsDYLFD X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.96 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796368880; b=UsWr62HVzkJEQcUeZBx3yVxmp85jRWGZcFQGviYcmI5mz8PwUkuerZg+oR6LV0d6WOtr dmFfT/5uvSI7zyE6dtqn2mgDFdEloJmkb+rk/cXz/8dVJDYr/ekJG8HXB6Yp8nVTEWJ/L W2OHOTwpmuRkLP3AUulwxAfOCABYNvD+fRdmteZbyf7cT+FkVPBH3dPwZn7KQXu6hVeWh lX+vQ8ryQXOw1TpMFX5xyoeg05Z/Zic0S7CF2H37K7LrBWCWanBfH/1qpsrs7+dc9WPbG NDFCKeEygG4GAtI49uaT8ogpQWrgJXpay1acSVrM0bd3isHcLPMoluqjNXpxuTaxDSw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796368880; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=0zvOSq/0M2yTd57kOj8gcpktp0NXonE8SLwXDejid6A=; b=DsfCsKxn/qGofUex3BCdGBHak+bNVYXM7O4N2+TZcR52exD8lvbaSc2jwBObrjKH828F hSRPM57r3Rgs9wfhdXsNTWKnjPvBft83/REjI5NcW0mCuOkhc9taNlXUvSSnLoJgcoUTk TX4oY/azSI/+k0qa96rKXfr1Vv+QndWUSuCAEm/boO3NWro7/Oovu4243gpTFFRDG5JBg 27xcW7AAJer1IXaPA7EoBN7bScrpz1Dt1BKE0tY8gH+xt53WguSxF5fnpzTbt/59qG9c2 B9KGFKQbh4Oj15FmqoU4E734nT2dPh+iuHtX7ThY98YLUoxaLXOT9W4fKW+FFsvPR3w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fJsDYLFD; arc=none smtp.remote-ip=95.215.58.96 X-Received: from mta1.migadu.com (out-96.mta1.migadu.com [95.215.58.96]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D378606A333 for <netdev@vger.kernel.org>; Fri, 4 Dec 2026 07:21:19 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9D378606A333 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=0zvOSq/0M2yTd57kOj8gcpktp0NXonE8SLwXDejid6A=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796368877; v=1; x=1796973677; b=fJsDYLFDSYCvq/eEFNOHUyuUVyo8xZy8ROa90+m+n8Q7sR3kziLubTTL2j+JO0IsQ5FoJOms OdN3krdGMKQ3XGZi/gQ9hI0Y2iOnRDeuJyUJfOUVWp1yQ+cmcXDLJux7aqhmzU71dySQvfORObN ijV74QLv48OMtQ3/S//N8OKk= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id c485b875999002de; Fri, 04 Dec 2026 07:21:17 +0000 X-Mizu-Trace-ID: c485b875999002de X-Migadu-Flow: FLOW_OUT X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Betterbird (macOS/Intel) X-Cc: netfilter-devel <netfilter-devel@vger.kernel.org>, linux-mm <linux-mm@kvack.org>, Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeel.butt@linux.dev>, Muchun Song <muchun.song@linux.dev>, Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>, Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>, Shuah Khan <shuah@kernel.org>, Tejun Heo <tj@kernel.org>, Vladimir Davydov <vdavydov.dev@gmail.com>, Chris Down <chris@chrisdown.name>, Zhang Jiao <zhangjiao2@cmss.chinamobile.com>, Song Hu <husong@kylinos.cn>, cgroups <cgroups@vger.kernel.org>, netdev <netdev@vger.kernel.org>, linux-kselftest <linux-kselftest@vger.kernel.org> X-In-Reply-To: <1a239b2ca50.36a66e22694686.5140051424523797730@asgari.net>