From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.158 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796368880; b=A1OHz2UCz1abIORJvCFLkRTKk6TXsHozq/pmr5NQ1PxSP4wyXWjdGaBCoasTK0rZupY3 uQ9w4+l8MDJHsh/4+sc1f8fyL/siGfDh+O3q4W9l9GFj9CoYbMlTQ3zIiwQ9Oe33jE5yD fHRHOvbLcVhyln61XMdKaC2LA2XeyXt/QrhU/aXx++222M2NjzUGhz024DW+3ts5pffAN fLl2sN2jbqsqFuODE2JTndCrnSHXm+wnBGMail2MVPTCiN08Hsi0Tr1UZSvTOs3nnkwj1 wd/O9muerRzOgBsBTmpq96MOGEifnx8PSseeMFEMU3OwO8YJ3Cz20khwiGUp6FhsA+g== 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=J8JasRO8IS8c877xz+2KYXTj1YQPaqGexHJ/l8URyLcSs/XkiAhMkQH2vmiIoAPbSxV1 7L597QuUoHFyF2dZSpATHrgm+E44avmKLd3WWrL0aYZWDUrrRYsQa/UP2hPFZslDtBgP5 7q65EfCtuqywg/7IgcVZrnIPVTy/PEv5qQoMgEolV+5Aowzq0ly5nBp8Q0zQz0KQ2YP5U +4px6ihErxCHIWSv418oFOuxMtVj9eXoKauaQm9dw7oDdLOfvP/G8UkYEZwKqTjm3l8rc GVhFVF08aKtUQ8x81+HNSIZqGYiysQc55kGQteLsIz1sazrHIlaoDJF8tUKlTFnKikw== 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=91.218.175.158 Received: from mta0.migadu.com (out-158.mta0.migadu.com [91.218.175.158]) (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 77112606A32C for ; Fri, 4 Dec 2026 07:21:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 77112606A32C 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: cgroups@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: cgroups@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: cgroups@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