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 B44DA3BC660 for ; Mon, 23 Mar 2026 17:02:49 +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=1774285369; cv=none; b=JR/sLRzEtbmZWe9Jk5VagqY843I1HK0eX6IXI0nMuGocbf5jGa74YmoyVhDZQi1Cs4I9Svd5CrTS28/irg7yXWLv9Q1uOViyh4PMwArsOsPgKr7e4m8Kkpv5uhe0n9vfgkvKp9j/DPJnNPt+TlWMbpeCZCoHMrcKlxtzTss6gS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774285369; c=relaxed/simple; bh=tZhnVjZ97khcZS0Gp/GbjbsEfzokXb/2ZQ2GVaQV1hU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MJ6Z+0DZzFb2SvYOwvz8w9RsxuifLBiEHYkdAHtMBR4p1mBwQBpmYWePZAg4zumST60KsKiPwHXG1nH3n20KajXAq6k0NMNLZxnDkXePLUmhVL0BhYtqgvkNaaLN5hoUcJn0FTU4y0xsSf7iDTVNPIxa2VahVenET965gkrFUBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o73d2bA0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o73d2bA0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5289C4CEF7; Mon, 23 Mar 2026 17:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774285369; bh=tZhnVjZ97khcZS0Gp/GbjbsEfzokXb/2ZQ2GVaQV1hU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o73d2bA0Q1qyv2dHc8YTTVnFiWUKJP6wo3soKs2CMs51g1mw6mT9KWp3CubbmXqKV 7jDJnkWgW2eHCIecUVldJLpSpOitXyyIfVzVLaylvo8gfuhgJQn9mRNig6hNX/QyG+ /QZwbTuYFYIrv7KTbuBzYlYELHqpuq2TL9ggRByBMyd7lUC0hHXCt+hLSitYEO7U+3 t2wQtTbNsYB4HF7njtrzdZ4H7NVR+2ycXxVIhA4lpztLi/09CnEV0JGSQjyEWcnF1r hbyljf7qNB4lCkSM0Md5qcGm3GA3yI5bNLTjAF8PHDxJeVa+obGmk5Awlekh8lvKTN iCvk4DfUpQ8Xg== Date: Mon, 23 Mar 2026 17:02:44 +0000 From: "Lorenzo Stoakes (Oracle)" To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, david@kernel.org, mhocko@kernel.org, zhengqi.arch@bytedance.com, yuzhao@google.com, shakeel.butt@linux.dev, willy@infradead.org, Liam.Howlett@oracle.com, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] mm/vmscan: prevent MGLRU reclaim from pinning address space Message-ID: References: <20260322070843.941997-1-surenb@google.com> <65cb38ee-2815-4b11-929d-3fc1528cc620@lucifer.local> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Mar 23, 2026 at 09:26:02AM -0700, Suren Baghdasaryan wrote: > On Mon, Mar 23, 2026 at 6:43 AM Lorenzo Stoakes (Oracle) wrote: > > > > On Sun, Mar 22, 2026 at 12:08:43AM -0700, Suren Baghdasaryan wrote: > > > When shrinking lruvec, MGLRU pins address space before walking it. > > > This is excessive since all it needs for walking the page range is > > > a stable mm_struct to be able to take and release mmap_read_lock and > > > a stable mm->mm_mt tree to walk. This address space pinning results > > > in delays when releasing the memory of a dying process. This also > > > prevents mm reapers (both in-kernel oom-reaper and userspace > > > process_mrelease()) from doing their job during MGLRU scan because > > > they check task_will_free_mem() which will yield negative result due > > > to the elevated mm->mm_users. > > > > > > Replace unnecessary address space pinning with mm_struct pinning by > > > replacing mmget/mmput with mmgrab/mmdrop calls. mm_mt is contained > > > within mm_struct itself, therefore it won't be freed as long as > > > mm_struct is stable and it won't change during the walk because > > > mmap_read_lock is being held. > > > > > > Fixes: bd74fdaea146 ("mm: multi-gen LRU: support page table walks") > > > Signed-off-by: Suren Baghdasaryan > > > > Oh and sorry, missed this - do we need a 'Fixed' for something that's just a > > perf improvement? > > > > This doesn't seem buggy? > > Well, if we are pinning something we should not is that a bug? I > didn't CC stable, so I don't expect it to be backported (though if > it's accepted, we will backport it in Android as it causes real > problems with reclaim), however if someone is looking for MGLRU fixes > I would like this patch to be discoverable. If you feel strongly about > it, I'll remove the tag. I don't feel that strongly about it :>) > > Thanks for the review! No problem! Working through your vma killable series atm also :) > > > > > Thanks, Lorenzo Cheers, Lorenzo