From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A916EC48BF6 for ; Sat, 24 Feb 2024 21:02:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BBD36B00CA; Sat, 24 Feb 2024 16:02:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 26B2B6B00CC; Sat, 24 Feb 2024 16:02:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 132C46B00CD; Sat, 24 Feb 2024 16:02:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 039FE6B00CA for ; Sat, 24 Feb 2024 16:02:35 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CC1E940444 for ; Sat, 24 Feb 2024 21:02:34 +0000 (UTC) X-FDA: 81827921028.06.382668B Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf17.hostedemail.com (Postfix) with ESMTP id A6CB34000F for ; Sat, 24 Feb 2024 21:02:32 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LIXU0YxG; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708808553; h=from:from:sender: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:dkim-signature; bh=A64W78NGaV24VMUTfu0Npfb4SI/GKSe6Qkqp5g06I3k=; b=HNlXNsNapwDLXRVJSmLkkIQNjOa8hbq0X+RpOsuVShtfbDEmT8I1kJIKeB5yRzRchG/C4j R99yyyMPsvao1fenVGBrACLkPh+RMyk2evVv2P4izNo1P/XQEi8Q1AS9saRaYR/SAnpG1P yKkuy+iAUEkGjXW58rTEQACEliFODTk= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LIXU0YxG; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708808553; a=rsa-sha256; cv=none; b=epnI07f4+I5JQYtaGU+rYk/iBC/iDhbV4gtOGzdaqCGoSt69eQ5+22dBu/tGUxehefda3Z Jmw7gZQ2ikq0nDjZ121jvZ/ALqyL+I0RGzaSfswQ8wXk8bMpbbawrItvfvAPC6GkXg7164 9eeEvj2j9w9IjdOyVxXMCYuOcm0IML0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 24A68CE0E46; Sat, 24 Feb 2024 21:02:29 +0000 (UTC) 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: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A6CB34000F X-Stat-Signature: 7dr3phstu8cw3anise41ffcdwyzpuy1g X-Rspam-User: X-HE-Tag: 1708808552-461395 X-HE-Meta: U2FsdGVkX1/rqswdeZKGPCDNzPJiLazf9VvXXd6PD/z/BtOJTj6nXrDP5wMjVDuxBlNQ5S6E8wwhT89R5VvZNAMjtDTLqyA5m6S3HrWeli1vaMFSeSvr5l9/70MlftA5M/RLjLuHDFESDzI589iYUwUGQ1mq0sbjlhwURFRXggtFSTvLCDv17mtKjiJYYCcS2e3Ider59qD1GyCz1p8fjkAdRiQRC9xDylEznMxZBDfmmzQb6AtEphuV0wPgCTvOxrih5yUmGo8of3J0WOFe67qchV+8Dt6xwtkPlpzwjCR2PoqHm6qVyJFIL3Wn6azLdre0mHLtzHFpttoEOOtpkNO/VewschW2Isw2IbKNskptUXwsASjranU3q1OaYH7AEb8TEVcSMNV0/K250tHzfSqRBg7lzIow2Q+DzjDsucUm++ytdskF9hcr16t7eSwuRf/N7Ki2Qn3dtCV4a0sba+htGh3eDkk/Uxcjvb6HsSQVDomMAWNgU7VhwhMyVzrYAxgsagyEAvksTKq/fmNVzBRpu+pYtGtrhdTA2eioTetFLeKxXyHZlTmUeG/nvxuTA6a0rTeun1cF3KP9Zl24fAsZfcMfJOP8LrIRPPGJcJdif7UAvj3WdRoqAmUVJu9zHfELnEmad48G716TO/376lkuThlWGhoA2Lo1XwRiIQg8+dIHglr86/VxZrbrHum/s+Fr5a9NBmavHPbxeRP6aQe4MJSFnHf2sXvAcQ3fPZZLNw1x1jm2ziYvySZcS2w9OcimPK/LN48sMa0AXA8cUMHnDT1qw3rl7dTGxm8Nn+5inHYB0vq2iad3M9GxrUEa+p5tjDzavTAUL/RPVrT45T4kbnCGWPN4nWrg28WGMj2ddI/UU/LbtsmCRe1SFzTMCV3F2JgNpwc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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