From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.94 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796368880; b=nme5F7f5i0jV9xoZUMxDZzWHINs44rT0MkNK/g/YQcHXdcNVUkYjbClJPmJttFleOy+u yrUa+L7O3nrzgv+8yt3+a0w0pQlV31Va6Me0wZO7Nh5yelI8mfOqXeM0w9CYNJoZ9RwJw kQoVbK7YYYKn27pY/dswi1X4l0uNeVpP0cdvw3jyf3qbmcibcrSWiv2L/HzFKtumdZl1E y3JbefhaIm3cl3/qDhlny3nkqQQpqffB9vjKKfv56furGZjM0yqV2ztvuf+dcjm3Nvotl zXiEbPkh6gdg1/D8TxPPGAvvehqI9P/Ms4g6XqxtWF1yp9AdZ7xgkVBDJDjuK30GSPw== 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=U0gEI+jINoYlad2271sN1ybYA0aXgA66QeVnI4PaHRG7lnS3ym/hiWsg8480m1LZwbXE a81xT2TY8GUPBi48r0rVsVKnGOYw35loxoYs+1I93i/6JdajtZEWSk4Q6K2yl6MBwoP4I SIshPxmRIqOekitAvn79V7Pz37Rg+h9Nh0GJ6qGBOLUpY8KvwwBg9L/BxwjMw4fA5ZI7u YW2taPvrSEO6EXW9crTJi6OtqnxjDRWsrsxuv8g2uo2PSH7NJiDAyzYuCEbo0gNAivtnZ njAUL1Z0POJegITYjjGFC+hz09UB2lnNOxcuYDwSpoLY6Bkk5+Mqsii0PMhoLNVbEpA== 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.94 Received: from mta1.migadu.com (out-94.mta1.migadu.com [95.215.58.94]) (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 7AFA3606A32F for ; Fri, 4 Dec 2026 07:21:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7AFA3606A32F 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: linux-kselftest@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: linux-kselftest@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: linux-kselftest@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