From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (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 ED64229BD8C for ; Thu, 25 Jun 2026 06:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782367916; cv=none; b=KBpHI5LoBkpy4TGi6WVsixtYgn10EpkHGFocmRdjKUWnT834jMY3CeHcIVNt+YMKfxfHlwyg4JyRPG1mJnuvZr5KY6W65xtyVJlyURdLBoYpQzEIlpWGaRUsLTy/0BflRUh0kjJgKRS04Otgrzw2qRsy95PvQ9K/uLAN4OyR/wA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782367916; c=relaxed/simple; bh=WgQRdI0Kdq7aEnVKb9c7OASS4yeb0qoaPNVU8f06+4Q=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pKGNDa1593T9VUNEfg7r2vR4EHcUJw+ZVD7aqldH2NCjh8kE2ArSL3OfGvoiwyNWrPJWaqSDTTPKzov8gQY5DQyJXuyAdv7K/J99jvYCscZM4jUjfNqEVVbeB1S8f82kbple5n49ffB2WBspJ7y7YQxXGe/+X7BZuq+ToE7Nh4Y= 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=iPGBHwrr; arc=none smtp.client-ip=91.218.175.170 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="iPGBHwrr" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782367902; 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=xUSTBB1mth+fzw/4QWCYM0WAsrU6UvEDP/rElXqwnzw=; b=iPGBHwrrH9Djk0Ix8CjAt1/PVSBSALGaCFIEyhK2JpKUjjK5oqL4Kvv49azNzeQj1p7opV AvvGRxc4A7tCrGXQeM9eUrYiqoM4c3Oxf9OY2OwHdnLR5DDX1qI4+bWRL0tkPtH6eDuH9m urj5++hBAxg8aHMFtF4rsCCPvANwrXM= Date: Thu, 25 Jun 2026 14:11:22 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2] mm: mglru: fix stale batch updates after memcg reparenting To: Harry Yoo , akpm@linux-foundation.org, david@kernel.org, kasong@tencent.com, shakeel.butt@linux.dev, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org, muchun.song@linux.dev, peiyang_he@smail.nju.edu.cn, mhocko@kernel.org, roman.gushchin@linux.dev, ljs@kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng , stable@vger.kernel.org References: <20260623024237.45990-1-qi.zheng@linux.dev> <8a76aefd-629c-41f3-b365-aefd4cc1411e@kernel.org> <7946da94-dc1d-4cf2-986e-466c378665b6@linux.dev> <1d638906-6d64-4e57-a181-4b77683652b5@linux.dev> 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/25/26 12:16 PM, Harry Yoo wrote: > [...] > >> So lock_batch_lruvec() can be implemented like this: >> >> #ifdef CONFIG_MEMCG >> static struct lruvec *lock_batch_lruvec(struct lruvec *lruvec) >> { >> struct pglist_data *pgdat = lruvec_pgdat(lruvec); >> struct mem_cgroup *memcg = lruvec_memcg(lruvec); >> >> rcu_read_lock(); >> >> /* >> * The memcg can be NULL when the memory controller is disabled. >> * Otherwise, the caller keeps the memcg owning @lruvec alive. >> */ >> if (!memcg || !css_is_dying(&memcg->css)) >> goto lock; >> >> do { >> memcg = parent_mem_cgroup(memcg); >> } while (memcg && css_is_dying(&memcg->css)); >> lruvec = mem_cgroup_lruvec(memcg, pgdat); >> >> lock: >> spin_lock_irq(&lruvec->lru_lock); >> >> return lruvec; >> } >> #else >> static struct lruvec *lock_batch_lruvec(struct lruvec *lruvec) >> { >> lruvec_lock_irq(lruvec); >> >> return lruvec; >> } >> #endif >> >> Does this make sense? > > Yes, looks good to me! OK, this sync method makes more sense as it doesn't require adding a new lrugen->reparente. I'll go with this method and update v3. Hi Barry and Baolin, what do you think? Since the sync method has been changed, I will temporarily drop your previous Reviewed-by tags in v3. ;) Thanks, Qi >