Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6352996pxu; Wed, 23 Dec 2020 23:13:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzeibRYefNyU3n8anHjdSZKSWOks7YXiyJo9kp61rvnfh7n0LTBgTzO3c+vhHOOC4SgBDng X-Received: by 2002:a50:9ea4:: with SMTP id a33mr27313299edf.70.1608793997337; Wed, 23 Dec 2020 23:13:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608793997; cv=none; d=google.com; s=arc-20160816; b=eWsqhqVxbWhLNVAmUCpQJuZZbfAkCa46Hh9QDXcVN2zJQ9dvH2s5CBEJn1ZE3SjOZt PAd4FkHR2nEDEL8UBQmymBWA8n/is5y8WVpmecUTXX6hgDp0rAkgpNxUd+ydHd1mzlUT cEioFcFeMpDQzeh1gvtmyoK/dyOyEKTwiTJvYiFTsN8oww6hMKK1MOyiWKMMXMesXZDc d6FXxD+ZPtIpQ9A98bodaFbgGH0uusK7L9G1boCVz5Qk8xgOgK48YpdZW80FHnrMwK3w sIwFlSqPQHvjTSxjI4b7oc9KUGnDnLJ1ibizIGzINjFMfa90toh05Ty0pcmTur6vTEJl RojA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=qB1g1eHuyQvggi8B8SoTOL62S33u6oe9Xwh0/sUKi0U=; b=XmJXc1/KNSEhFLAM0ZjeXWaD6zG18h4AH0kDnQDSm0+e/RqFT3vuO1ELfENxxg1PB9 5fPfukZJtx4Zj9E5WK93Qzl4AY61L+ymSwkInupDWZ3FdaJmCX8EayvJpZ6UbpuxWP9+ TfE0mOreHo45LuZ5pE7LWrb47wMWiuhO7t3Uxv9pGqw0VliVRiVEl4i3p8FUOePE7G/u kih7z3GCddSXkUt/Xp+J+2P9I9+q1sEzSFcqeqfiYSjEl1JwGvnW7nO0sieo3Ra/9AaM ThtCW9/9984PGDQg57/QJrFwTG8Q+Z8kr34fRPmU7Oqhf5dKcfI2CBCIPYukQ8AjIp++ QqTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=L19tZZUq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si15618854edw.41.2020.12.23.23.12.54; Wed, 23 Dec 2020 23:13:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=L19tZZUq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725950AbgLXHM1 (ORCPT + 99 others); Thu, 24 Dec 2020 02:12:27 -0500 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:6223 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbgLXHM0 (ORCPT ); Thu, 24 Dec 2020 02:12:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1608793947; x=1640329947; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=qB1g1eHuyQvggi8B8SoTOL62S33u6oe9Xwh0/sUKi0U=; b=L19tZZUqPYWtH9jhn+WTUO1+M5/Bk26ZmpoKRW0P6Zbt8JQ4Z1GTvXZA WBPog1+1I4R4nLuLU9EYIFTIFpemK/8cI5b6aBQRgADi4r98if5SZVDZg terQtSNq2nDF8NXzaTn8OcUPmURWgEYL3Yx7tLG0AND6cr0ZW7qUZI+AB A=; X-IronPort-AV: E=Sophos;i="5.78,444,1599523200"; d="scan'208";a="98777246" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2c-76e0922c.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 24 Dec 2020 07:11:46 +0000 Received: from EX13D31EUA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2c-76e0922c.us-west-2.amazon.com (Postfix) with ESMTPS id E8608A831F; Thu, 24 Dec 2020 07:11:42 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.162.252) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 24 Dec 2020 07:11:25 +0000 From: SeongJae Park To: Shakeel Butt CC: SeongJae Park , , "Andrea Arcangeli" , , , , , , Brendan Higgins , Qian Cai , Colin Ian King , Jonathan Corbet , "David Hildenbrand" , , Marco Elver , "Du, Fan" , , "Greg Thelen" , Ian Rogers , , "Kirill A. Shutemov" , Mark Rutland , Mel Gorman , Minchan Kim , Ingo Molnar , , "Peter Zijlstra (Intel)" , Randy Dunlap , Rik van Riel , David Rientjes , Steven Rostedt , Mike Rapoport , , Shuah Khan , , , Vlastimil Babka , Vladimir Davydov , Yang Shi , Huang Ying , , , Linux MM , , LKML Subject: Re: [PATCH v23 05/15] mm/damon: Implement primitives for the virtual memory address spaces Date: Thu, 24 Dec 2020 08:11:11 +0100 Message-ID: <20201224071111.11551-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.252] X-ClientProxiedBy: EX13D22UWB002.ant.amazon.com (10.43.161.28) To EX13D31EUA001.ant.amazon.com (10.43.165.15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Dec 2020 14:54:02 -0800 Shakeel Butt wrote: > On Wed, Dec 23, 2020 at 8:47 AM SeongJae Park wrote: > > > [snip] > > > [snip] > > > > + > > > > +static bool damon_va_young(struct mm_struct *mm, unsigned long addr, > > > > + unsigned long *page_sz) > > > > +{ > > > > + pte_t *pte = NULL; > > > > + pmd_t *pmd = NULL; > > > > + spinlock_t *ptl; > > > > + bool young = false; > > > > + > > > > + if (follow_pte_pmd(mm, addr, NULL, &pte, &pmd, &ptl)) > > > > + return false; > > > > + > > > > + *page_sz = PAGE_SIZE; > > > > + if (pte) { > > > > + young = pte_young(*pte); > > > > + if (!young) > > > > + young = !page_is_idle(pte_page(*pte)); > > > > + pte_unmap_unlock(pte, ptl); > > > > + return young; > > > > + } > > > > + > > > > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > > > > + young = pmd_young(*pmd); > > > > + if (!young) > > > > + young = !page_is_idle(pmd_page(*pmd)); > > > > + spin_unlock(ptl); > > > > + *page_sz = ((1UL) << HPAGE_PMD_SHIFT); > > > > +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ > > > > + > > > > + return young; > > > > > > You need mmu_notifier_test_young() here. Hmm I remember mentioning > > > this in some previous version as well. > > > > Your question and my answer was as below: > > > > > Don't you need mmu_notifier_clear_young() here? > > > > I think we don't need it here because we only read the Accessed bit and PG_Idle > > if Accessed bit was not set. > > > > I should notice that you mean 'test_young()' but didn't, sorry. I will add it > > in the next version. > > > > I should have said mmu_notifier_test_young() instead of > mmu_notifier_clear_young(). > > > > > > > BTW have you tested this on a VM? > > > > Yes. Indeed, I'm testing this on a QEMU/KVM environment. You can get more > > detail at: https://damonitor.github.io/doc/html/latest/vm/damon/eval.html#setup > > > > Hmm without mmu_notifier_test_young() you should be missing the kvm > mmu access updates. Can you please recheck if your eval is correctly > seeing the memory accesses from the VM? Seems I didn't clearly answered, sorry. My test setup installs the DAMON-enabled kernel in a guest VM and run it for workloads in the guest, rather than running DAMON in host to monitor accesses of VMs. The MMU notifier is for latter case, AFAIU, so my test setup didn't see the problem. If I'm missing something, please let me know. Thanks, SeongJae Park