Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp565315rbb; Sat, 24 Feb 2024 13:02:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVOK7cQ8UZt/tXsQTqS0i/XLe3VqjeQ5tXHA4Yy9iNmdMBK4/bMyneQt9/7Hyg9B9hdXLS+7HErma2v11V5j3pr6UrzvHaZh6nXKw23WA== X-Google-Smtp-Source: AGHT+IFhcUVlx/3ub6ZBtUOBxojvohPEN4jmtxy/CQz0S80bQEdNWhTAI6npV7lBzMTPrdp+68dL X-Received: by 2002:a17:90a:f40e:b0:29a:427a:2c83 with SMTP id ch14-20020a17090af40e00b0029a427a2c83mr2857739pjb.29.1708808552381; Sat, 24 Feb 2024 13:02:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708808552; cv=pass; d=google.com; s=arc-20160816; b=PuM2K+0Lyq+MyPSyZ2wuqcEjtHb4Zuncdq1yBYRqe3GPXVmAWE1Phon/+ALy2O1xMR 4UVpdBBEpF1FP6B4Um4I7YLbktSSH6tIPeDO+Fs6/VRsWuAcCLbs8vzNXjdeN5Hei50O nNPZYpm1aI72rieou88IQzNjgnvyy1CFyInCiO4PEuzJTGUgkGIJxmvBnYkSm4H5bTun IrhtfhW372ka4WtgsZjMixtHaI0tKnsgN1NM5KJhIxEqyV2lLk5g5XntXAjXC7Uc3wtU f+flLAhrAbYY23d/aS6B40Y9CDmbHukP/cwB47HXISyvxtTHZa9e/wmcbMDwQQEgvNPg x5rA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=A64W78NGaV24VMUTfu0Npfb4SI/GKSe6Qkqp5g06I3k=; fh=B7XvgPn5p34LtWZ0WRoSpXtSUp2UdZNyH3t/LkPuHQI=; b=O+hw5aabvNiccP5HeOyq+IrE0M+JUar+JSAj5itpk5KoS60ftfaw/4W8zVH3BLIoxs CB5IzM2TtkDV3poJsuKiS+t1ur+NhZMEI8zzLVIcwi8fw57Em0T2kcSeuZ/6OaehGDUI hWr7V4acbq6moYKx6DYp1jkmdFDcHeygfQMCkXpPNoosYU2jEArKTpXpVYePX69bxnPO ylgWsLyEPNQe4Ew+5mD8vYK5WlnZB6i7SDmHjr0Dhlhw7738OLYbZlroGyMf5l+Iear8 MePDCfmSlvVDAzUD53pOyBb8i5L91cCJFI8a3Z3RS4yh+fp9Y7GAtKCouRHSaTz/ofxw PfMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LIXU0YxG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79855-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79855-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ot17-20020a17090b3b5100b0029aa2cc129asi957378pjb.158.2024.02.24.13.02.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 13:02:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79855-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LIXU0YxG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79855-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79855-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B6F0282202 for ; Sat, 24 Feb 2024 21:02:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D11DE4D59C; Sat, 24 Feb 2024 21:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LIXU0YxG" 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 E51C44CDFB; Sat, 24 Feb 2024 21:02:28 +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=1708808549; cv=none; b=l8V9A9v7+5S+N3kQYeLsdiFjBNVgEplLIjtrDl1K2meanIi1Izs5LKMEnpJYBGJUDU8InA/PHV0kS8/tpVbExfU23u2L4N48npI5++QQZ/W6PO09XkI3WbVUuDQDA/a1QtgLKXpOpYlZtHuCg9gsy0SC3IisZd/Yt4oJgDviiuo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708808549; c=relaxed/simple; bh=DBksNLTYfjt6+EX3HN5+PfdJ9HZ1Fi3NzTEwfk1Wj9o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=uMO6Nz9+6hJNURGc12d5COIPaWmkG0uzGZpP6FaWVkhM2D+DhzkIP3/3PfF5okAvMy5+WZ8j/xXoUMfG0NWxE0xAfXoYscOryyENbIN20OEn/7xVSAxnElvqN/Re8In86EwsFgIsfWvmdl/3am8aMxVM81zwtfCbZgkvw+uUVAI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LIXU0YxG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93603C433C7; Sat, 24 Feb 2024 21:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708808548; bh=DBksNLTYfjt6+EX3HN5+PfdJ9HZ1Fi3NzTEwfk1Wj9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIXU0YxGcL2vXyF1XOBoBcPw3rrkRPzvqdj/mE4SgPvlIj/lK4sF7d93bkGTngfuQ qSlm74y0cI0vOODSbKmMFEKHyuFlrlxpsrcteyCwPGXBtfPaoFrt3w0Pp79VvePY7e Buk7Yfguhg5My1B56YP+UVna4Dcuy+OS537MGhwCji7vzPTvVGGsVx0pfQZuDhe0pj BwBw95v4h8+dUFHz3wh0yfMWeVijLI8OKvzOn1M90jQRHLEac670wYptO1Ut4FV7aq 6OzpcYwkOJz39eJJnPqA8lhyez6C0tGKVZKh4D9zdxkkghpN+h77XLqCCVTE+8ZDka 0Qic/paZ8CRSw== From: SeongJae Park To: Barry Song <21cnbao@gmail.com> Cc: SeongJae Park , Minchan Kim , akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, mhocko@suse.com, hannes@cmpxchg.org, Barry Song Subject: Re: [PATCH RFC] mm: madvise: pageout: ignore references rather than clearing young Date: Sat, 24 Feb 2024 13:02:25 -0800 Message-Id: <20240224210225.47149-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: 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-Transfer-Encoding: 8bit On Sun, 25 Feb 2024 04:33:25 +0800 Barry Song <21cnbao@gmail.com> wrote: > On Sun, Feb 25, 2024 at 4:12 AM SeongJae Park wrote: > > > > On Sat, 24 Feb 2024 11:07:23 -0800 SeongJae Park wrote: > > > > > Hi Barry, > > > > > > On Sat, 24 Feb 2024 12:37:59 +0800 Barry Song <21cnbao@gmail.com> wrote: > > > > > > [...] > > > > > > > > BTW\uff0c > > > > Hi SeongJae, > > > > I am not quite sure if damon also needs this, so I have kept damon as is by > > > > setting ignore_references = false. MADV_PAGEOUT is an explicit hint users > > > > don't want the memory to be reclaimed, I don't know if it is true for damon as > > > > well. If you have some comments, please chime in. > > > > > > Thank you for calling my name :) > > > > > > For DAMON's usecase, the document simply says the behavior would be same to > > > MADV_PAGEOUT, so if we conclude to change MADV_PAGEOUT, I think same change > > > should be made for DAMON's usecase, or update DAMON document. > > > > Thanks to Barry's nice explanation on my other reply to the patch, now I think > > the change is modest, and therefore I'd prefer the first way: Changing DAMON's > > usecase, and keep the document as is. > > Hi SeongJae, > > thanks! I actually blindly voted for keeping DAMON's behaviour but > slightly updated the > document as I set ignore_references to false for the DAMON case in the RFC :-) > > --- a/mm/damon/paddr.c > +++ b/mm/damon/paddr.c > @@ -249,7 +249,7 @@ static unsigned long damon_pa_pageout(struct > damon_region *r, struct damos *s) > put_folio: > folio_put(folio); > } > - applied = reclaim_pages(&folio_list); > + applied = reclaim_pages(&folio_list, false); > cond_resched(); > return applied * PAGE_SIZE; > } > > MADV_PAGEOUT comes from userspace by a specific process to tell the kernel > to reclaim its own memory(actually focus on non-shared memory as it > skips folios with > mapcount>1). > The range is a virtual address and the app does know it doesn't want > to access the > range in the foreseeable future. and the affected app is itself not global. > > In the DAMON case, it seems the range is the physical address. if > the pa is mapped > by more than one process, it seems safer to double-check in the kernel > as it might > affect multiple processes? > > Please correct me if I am wrong. You're correct. Please consider below in my previous reply[1] as my opinion. let's keep the change for paddr.c in your patch as is. [1] https://lore.kernel.org/r/20240224205453.47096-1-sj@kernel.org Thanks, SJ > > > > > > > Thanks, > > SJ > > > > > > > > > > > Thanks, > > > SJ > > Thanks > Barry