From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (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 9D26F31F9BA for ; Fri, 26 Jun 2026 11:21:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782472921; cv=none; b=sxNMjcj3Sh1qTJnKgCYopicoBBsNECTFeABgYkIOwfYYxWqSkGeT6ZVAOXErSxNxEVva2cGLR7Z9TB3IhfyniLbSTGQbY+sKly/QJgS/DIdRU6IEhZ0BBwZ+2VxVvTFklIGbwq+GhHzSUQp2+81noduHuzr7EriONaxEGjuC8P8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782472921; c=relaxed/simple; bh=9spW60n7KVcrvhkMswN0/3I2GFHz+mOsLIJkdth7eHg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HDlBT/eI/cIH0MpCXc4O47hLhPeDA/4apZnbQSn2KSY/zspr78QdHiwgGfXClZtj3QIGtdn+kPVAKvHkRp2pqItUdBFwc/H9vqspEmVgdz8MiYARttk2LPiG8g8tlNnEy9cJkxwr//WZ4F/e6U4KlHIP8qw4YicfeffNz3tjTm4= 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=ShybaEdE; arc=none smtp.client-ip=95.215.58.182 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="ShybaEdE" Message-ID: <57c18afd-e2a3-4b37-90b6-f2a4c758e8aa@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782472907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sXnGSQ/f8kthQgxhjN/qMHFlHYZPXPOXt+bobY0m7Ck=; b=ShybaEdEuvjaq13R1piH2Z+U9a0wSOAEKFD90/s1i7ZE77Vs1RndU1kW6KQ7qUbtW79HcD vreqzNqtQaQeE+7AcQ8JQkv+EBQd3thYj97SSBWGmSD22qqs/z7PobV/u8tB2breJGoknE My76uAFXDSZY5f+J75MBfMNtqFjnir8= Date: Fri, 26 Jun 2026 19:21:28 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v3] mm: mglru: fix stale batch updates after memcg reparenting To: Johannes Weiner , shakeel.butt@linux.dev Cc: Harry Yoo , akpm@linux-foundation.org, david@kernel.org, kasong@tencent.com, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, muchun.song@linux.dev, peiyang_he@smail.nju.edu.cn, mhocko@kernel.org, roman.gushchin@linux.dev, ljs@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng , stable@vger.kernel.org References: <20260625151554.55105-1-qi.zheng@linux.dev> <4c7b0c46-14f0-4a62-893e-e50714e09b74@linux.dev> <46ac28bf-5be1-4600-b522-0a1aa76c28e6@kernel.org> <08cf8972-6cfc-4452-9a3c-88e0368dbbf9@linux.dev> <90fd5300-1016-42e7-abad-08ad85fb62b4@linux.dev> <5a0c6597-6b96-4781-a71b-fd1298b2b7bb@kernel.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qi Zheng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 6/26/26 5:39 PM, Johannes Weiner wrote: > On Fri, Jun 26, 2026 at 03:04:17PM +0800, Qi Zheng wrote: >> On 6/26/26 2:48 PM, Harry Yoo wrote: >>> On 6/26/26 3:24 PM, Qi Zheng wrote: >>>> On 6/26/26 12:59 PM, Harry Yoo wrote: >>>>> Observing a dying cgroup should be rare anyway, it's worth focusing >>>>> more on readability? >>>> >>>> While it's rare to encounter consecutive dying memcgs, it can still >>>> happen, right? >>> >>> But is worth saving a few instruction in a basic block that is >>> unlikely() to be executed? >> >> I don't have a strong opinion here. Hi Johannes, I'll leave the decision >> up to you. If necessary, I can send out the v4. > > Yes, I was thinking what Harry actually bothered to spell out ;) > > The race is rare, multiple levels even rarer, and even *then* > mem_cgroup_lruvec() is a quick inline. > > This way you have one block to handle that one rare race > condition. One place to put the comment. No labels, no goto. > > Simplicity wins :) Okay, I will update it as you suggested and send out the v4. Hi Shakeel, do we really need to move lock_batch_lruvec() to memcontrol.h? It's currently only used by reset_batch_size(). Thanks, Qi