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 83846C6FA86 for ; Tue, 13 Sep 2022 15:29:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BF6F8D0002; Tue, 13 Sep 2022 11:29:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96F078D0001; Tue, 13 Sep 2022 11:29:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85EAE8D0002; Tue, 13 Sep 2022 11:29:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 768088D0001 for ; Tue, 13 Sep 2022 11:29:42 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 43BF61C681C for ; Tue, 13 Sep 2022 15:29:42 +0000 (UTC) X-FDA: 79907447004.12.DA7EFB0 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by imf18.hostedemail.com (Postfix) with ESMTP id 777931C0098 for ; Tue, 13 Sep 2022 15:29:40 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VPhRWsB_1663082976; Received: from 30.27.95.99(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0VPhRWsB_1663082976) by smtp.aliyun-inc.com; Tue, 13 Sep 2022 23:29:37 +0800 Message-ID: <9856e03f-a1da-1b56-b15a-1a644ae19b89@linux.alibaba.com> Date: Tue, 13 Sep 2022 23:29:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH] mm/damon: add MADV_COLLAPSE support in damos_action To: SeongJae Park Cc: akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220913151755.103334-1-sj@kernel.org> From: haoxin In-Reply-To: <20220913151755.103334-1-sj@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663082981; a=rsa-sha256; cv=none; b=VYVrWDDxivSaWsSUycGxLGIP/KLvrmhy7mUZUlYsxJhwaezllH5vqAnESZ9TaVZRT5X5X4 4+lWPeKdoP7h9GgIyRCrAf0feoJfuy+GfmXMXRIl8GQF010Iw8USJXXx4lS2JUqYl+OIvd TrWB53Cfkexjkts8IBLY25/azW2yoZw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.42 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663082981; 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; bh=XPDb90gnsD385NwyULAbuML0v6KnmQDgHabICbUXFh8=; b=3D02KWoR9LgWByz9thHT2f9QBlzD9kXHzRWOyWE8TfydKEd6T2aJL0qBu900OOGIWJgroS QGANIgYmoJ8bfBWISfuZk4w8UUXEctKhkY660i/yjV/JvUsnAIo2YaZYrCaBqdS64PUyua fZMLwxMCMf1bZ7oHcnLgQtEtdI+8o58= Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.42 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: oj17r1whfcy7i7ojgub5hxzd7xbff6to X-Rspamd-Queue-Id: 777931C0098 X-HE-Tag: 1663082980-89524 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: Hi  SJ, 在 2022/9/13 下午11:17, SeongJae Park 写道: > Hi Xin, > > On Tue, 13 Sep 2022 19:47:35 +0800 Xin Hao wrote: > >> MADV_COLLAPSE has large different with MDVA_HUGE in dealing with huge >> pages, it doesn't need to rely on 'khugepage' thread to create THP. >> So combining with it will give damon users more options. > I think this is a simple and worthy change, but... could you put some more > detailed explanation of the scenario that the action could be used? Also, it > would be good to have some evaluation results you got with this change. Yes, internally, we use this feature mainly focus on two reason: the fist one,     prevent performance jitter casused by khugepage thread under memory pressure. the second one,     khugepage thread merge hugepages is  slowness then MADV_COLLAPSE. > > Als, to my understanding, MADV_COLLAPSE is not merged in the mainline yet, > right? I believe it will make it in v6.1-rc1. That said, to make Andrew's > burden less, how about delaying this change until MADV_COLLAPSE is mainlined? > If you have some numbers showing clear and great benefit of this change, I > think it would be worthy to add immediately, though. > > > Thanks, > SJ > >> Signed-off-by: Xin Hao >> --- >> include/linux/damon.h | 1 + >> mm/damon/vaddr.c | 3 +++ >> 2 files changed, 4 insertions(+) >> >> diff --git a/include/linux/damon.h b/include/linux/damon.h >> index 016b6c9c03d6..c44f9410d997 100644 >> --- a/include/linux/damon.h >> +++ b/include/linux/damon.h >> @@ -97,6 +97,7 @@ enum damos_action { >> DAMOS_PAGEOUT, >> DAMOS_HUGEPAGE, >> DAMOS_NOHUGEPAGE, >> + DAMOS_COLLAPSE, >> DAMOS_LRU_PRIO, >> DAMOS_LRU_DEPRIO, >> DAMOS_STAT, /* Do nothing but only record the stat */ >> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c >> index c2c08c1b316b..58c0d068563d 100644 >> --- a/mm/damon/vaddr.c >> +++ b/mm/damon/vaddr.c >> @@ -655,6 +655,9 @@ static unsigned long damon_va_apply_scheme(struct damon_ctx *ctx, >> case DAMOS_NOHUGEPAGE: >> madv_action = MADV_NOHUGEPAGE; >> break; >> + case DAMOS_COLLAPSE: >> + madv_action = MADV_COLLAPSE; >> + break; >> case DAMOS_STAT: >> return 0; >> default: >> -- >> 2.31.0