From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 44A7F192B75 for ; Sun, 14 Dec 2025 23:49:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765756186; cv=none; b=oIUQ16vRxBMKxAQl7sqgdnIn40WwAElhzV6K5lDzDLvtf78uXenaEgZR/hapNOaJLl3ouep6wMxTMmEW61HMViX68bCI1Gw0m7JKdRxBBjtCwv7QGi6PIFGiX4G2oTbpP0DKVxeUCp7nbVg9kw9ZPmyqOZj/PwN/O6Q/IXQtg/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765756186; c=relaxed/simple; bh=Ah7HCannd9gaGWJFa84Zv3eVPb3Lkum8nZV6/3inVQs=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=pGCoVpgNK9t4jfVr+N2SvdZmQZANEhtikvLACG1Xe+wHbgfkN+tBDqckp+FoRAqX2t0gspOZPFtgmY+GjdyII9lSuGLSRNZ8AWPUlLZxG8gPuEY/xmw10D3ZwTWTJ+2yu1hp0NYAejUpdPUz+Snv0EP4T93jYGPOosd7maNkd+M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=RS4l/RZH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="RS4l/RZH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C77AC4CEF1; Sun, 14 Dec 2025 23:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1765756185; bh=Ah7HCannd9gaGWJFa84Zv3eVPb3Lkum8nZV6/3inVQs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RS4l/RZHDooKtVB05At7vYIs8ePU8T6hnTv8ahVsuEi08OIL99u9pP8En9iILpv3O 38Aj/BeJvAL3Z8xFUpsjzqO7GehatUgB8vyqhSE+PsI6Wc1etruP4Q9bjCzutdDqaA hSK4GTnriwfXlftGpNUwhii/vNnqJv2vezdgKQCQ= Date: Sun, 14 Dec 2025 15:49:44 -0800 From: Andrew Morton To: Deepanshu Kartikey Cc: axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org, david@kernel.org, mhocko@kernel.org, zhengqi.arch@bytedance.com, shakeel.butt@linux.dev, lorenzo.stoakes@oracle.com, yuzhao@google.com, heftig@archlinux.org, oleksandr@natalenko.name, bgeffon@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, syzbot+90fcab4d88cffed6d0d8@syzkaller.appspotmail.com Subject: Re: [PATCH] mm: vmscan: always allow writeback during memcg reclaim Message-Id: <20251214154944.6a6e91ffb00677a5164074e9@linux-foundation.org> In-Reply-To: <20251213083639.364539-1-kartikey406@gmail.com> References: <20251213083639.364539-1-kartikey406@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 13 Dec 2025 14:06:39 +0530 Deepanshu Kartikey wrote: > When laptop_mode is enabled, may_writepage is set to 0 in > try_to_free_mem_cgroup_pages(). This triggers a warning in MGLRU's > lru_gen_shrink_lruvec(): > > VM_WARN_ON_ONCE(!sc->may_writepage || !sc->may_unmap); > > The warning occurs because MGLRU expects full reclaim capabilities to > function correctly. The call path is: > > mem_cgroup_resize_max() > try_to_free_mem_cgroup_pages() > do_try_to_free_pages() > shrink_node() > shrink_lruvec() > lru_gen_shrink_lruvec() <-- WARNING > > Unlike kswapd or direct reclaim where laptop_mode's disk-saving behavior > is a reasonable optimization, memcg limit enforcement is a hard > requirement - memory MUST be freed when a cgroup exceeds its limit. > The may_unmap field is already set unconditionally to 1 in this path, > acknowledging that memcg reclaim needs full capabilities. > > Set may_writepage unconditionally to 1 for memcg reclaim to ensure > MGLRU works correctly and memory limits are properly enforced. > Thanks, I'll add this to mm.git's mm-new branch for testing. I expect a few days after that I'll quietly move it into the mm-unstable branch where it will receive linux-next exposure. Further progress into mm.git's non-rebasing for-next-merge-window mm-stable branch will depend upon review outcomes.