From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (mta1.migadu.com [37.59.57.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2ADC379C48 for ; Fri, 7 Aug 2026 09:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.59.57.117 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786093280; cv=none; b=q2njGEMfkIHc2yZgEIXJhMMqksugnNIyrRZMNuQbWi9BG1IUXwKYUJiHWpbGbSxi31+hDbFfj1gPYzOVP/BY/2e3I44px9SvThza/m+Si1CRo7XKaaoVKI8RZMxPrGh7SWEV4HI2pir1HFQbxHC5lkCgk9er9FCgbjib4x8HapQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786093280; c=relaxed/simple; bh=TJnUCbidlwGzGjYbztKu2y8hnN9tQkGSLHjqCNwQs+8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=srmvHe1s1XTo2oH5FIJyfhDlenBCe+Gs6t4SWcSwGRCqXj4O3L/Kj9JOWzmr0HcMMKC7GPJbMWMSmPfaWkNH7JVsf7q4xPd8NONs3WVioKvO7MnuadCuf65AEYd6QefZmnfYR+0E7dMmpAAf+2Be4C2UjO1kxp7Pr7QoH4nHieY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=r3pfHblt; arc=none smtp.client-ip=37.59.57.117 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) header.d=linux.dev header.i=@linux.dev header.b="r3pfHblt" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1786093275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=tc+4Pm1WPXx8lrlIpIcW9us+Omuxqmtf7stMvPslqPY=; b=r3pfHbltofdChVFLczD3R5Ob2r8ULIyo2ReT6AHaeUGlgbdsptevt7KU8NyqXudUu+2WI1 Pn6HQYKelQMb0mhENxindbZn5PcO05AlIhAD7nwUtRHMNUYRmc4t6w6PHXQNkiMNoCZaZf zinKwp/Xo977YuUxbl1JRHt40RlhlSE= From: Ridong To: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Andrew Morton Cc: Muchun Song , Tejun Heo , =?UTF-8?q?Michal=20Koutn=C3=BD?= , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ridong Chen , cui.tao@linux.dev, Ridong Chen Subject: [PATCH v2 0/2] mm, memcg: fix memory.peak reset clobbering other fds' watermark Date: Fri, 7 Aug 2026 16:59:58 +0800 Message-Id: <20260807090000.1532495-1-ridong.chen@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Ridong Chen Two fixes for the per-fd memory.peak / memory.swap.peak handlers added in c6f53ed8f213. Each open fd reads back max(its own value, the shared local_watermark), and both bugs live in that scheme. --- Changes since v1 [1]: - New patch 1: hold peaks_lock in the peak readers (Sashiko). - Patch 2: floor the peers with max(usage, local_watermark), mirroring peak_show(), and skip the writing fd (Johannes Weiner). [1] https://lore.kernel.org/all/20260730115314.1069089-1-ridong.chen@linux.dev/ Ridong Chen (2): memcg: acquire peaks_lock when reading memory.peak mm, memcg: fix memory.peak reset clobbering other fds' watermark mm/memcontrol.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) -- 2.34.1