From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.96 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== 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== 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 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 ; Fri, 4 Dec 2026 07:21:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9D378606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev 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-Envelope-To: netdev@vger.kernel.org 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 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 Message-ID: <2dfe4f8e-e87d-444f-b3c6-a6acd615013b@linux.dev> Date: Fri, 4 Dec 2026 15:21:08 +0800 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Betterbird (macOS/Intel) Subject: Re: [PATCH RFC nf-next 2/9] memcg: bound memory.high delay arithmetic To: Alireza Asgari Cc: netfilter-devel , linux-mm , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , David Hildenbrand , Pablo Neira Ayuso , Florian Westphal , Phil Sutter , Shuah Khan , Tejun Heo , Vladimir Davydov , Chris Down , Zhang Jiao , Song Hu , cgroups , netdev , linux-kselftest 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> Content-Language: en-US From: Hui Zhu In-Reply-To: <1a239b2ca50.36a66e22694686.5140051424523797730@asgari.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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