Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1523939ybz; Sat, 18 Apr 2020 02:50:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJM7AFDgJKNJJ2ILx+H2UR08V4KmY1niY54Kkbfi2sW299Awq2+BGe/EgmD4Nt6ahgVzrEJ X-Received: by 2002:a17:907:1199:: with SMTP id uz25mr7027745ejb.131.1587203432272; Sat, 18 Apr 2020 02:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587203432; cv=none; d=google.com; s=arc-20160816; b=Nl+zpvwRAdV3OBCuihz6ebIp9Aqa7MrLuOsSdonkbZsFAk1uxjBkZcN4CUg18wihRP XKlx1m+jljmh4cdHiCnKVavzkM4hv/lKkX7V684ksYDMOW8XK/hQiQMyN+wSq/MjwAS5 Vd4PqIzDemQ2mqwM2ufx4k8/ZYlpobcRc8LvUtByBZO01sqkIMHWAul7KHUuYg9x7L8z BMfTeacPCV5HH4i9ZG4X6D3pGXXRjaeZp+BiVsSv/OkVSV4vYDhOT6yR4IY+WbyG+23S Gz+f8DhBEVR0Fr08QyptTB4V8IpYtD6wkY2YZTh1gh7AKmZGGPOJ9ANv4wtnKGAsJeTA /TGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yppnx2RRRH6dXEAoSsBWx8ZDGYXI8EKm8jvsYqKLP1E=; b=NdMI/3Lwf+sNppT2Ey5BLh3RoqLgu17aWI2CR4BnoU95oJ0Ijw3xo1QmUCf9s0lBYq nDnQbJEWITMKomay2X+Yi6eMOGg4XIwAtCC4HfYrsDslpIuZo81LPAi4+IRcuger9i5U dUaTh1LDmoaVAfG/MwjMoyFw1/vgBWLxOJ9xWXql5MIQrKr8aZ6iq2/PtTj2NyKtRmOR 8YTZ2GKwYb4qDGJjt3nXCYSN7oV/JFXMZgGKXLDODpdCrVMzy9I4CPvxJzc34kNCsUBS URY7cIbD27moJQ9g8jQlzCZjUqqr1HfsDQBUggs1qzd6wOZvUn7vfvEVFZklmFWf0YmC O7AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ME8UtMFW; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si14619867ejy.188.2020.04.18.02.50.08; Sat, 18 Apr 2020 02:50:32 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=ME8UtMFW; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725891AbgDRJsV (ORCPT + 99 others); Sat, 18 Apr 2020 05:48:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725856AbgDRJsU (ORCPT ); Sat, 18 Apr 2020 05:48:20 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11D0EC061A0C for ; Sat, 18 Apr 2020 02:48:20 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id k11so5774953wrp.5 for ; Sat, 18 Apr 2020 02:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to; bh=yppnx2RRRH6dXEAoSsBWx8ZDGYXI8EKm8jvsYqKLP1E=; b=ME8UtMFWbT941uR7oSocXnBCpbpKwfoPlneWRsX58TC3vJrZ/9VvbpiTseKmNK01vX R7lTwAvYFwHCidRBF+U+UGw1fadYUhb1qkRRr7wDWQ0C8Z3A7Vt/gvd8q+j94AhSUFB4 EdFgcLTPa/aBeW10TQMn803vIgBPf1Eh+yd+lBf9a74n0KCLzbeyPggtMAXbpe+uIn6D M/lz9isgvD6P78K4Lce/hoBgODW29Y3gjMpUyAqA37DO/FSv2JthSth81Wz8wQGo9Jzi ZeXHCS74SIBJQBvqO/dtHmUdzAxRTlOK2mzdAyz+H4ZoK2+Az1cvAoEAIwxMnS8g+9n9 24tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to; bh=yppnx2RRRH6dXEAoSsBWx8ZDGYXI8EKm8jvsYqKLP1E=; b=MRBL4Kr2MjztA6b/A404QRjdzDeBHJgXcUje5O4CQjg/V2+pmQx2aawIyxeEeJ9K7K 5bCXlFDBq8W0lzMXKt+ut9Ibls7AKyvP5hXE7llACFvxxXFB644cwODVU5rU6kj7uw4Z 8WfNuUXqg33x8P0gll8vLA9Z73iEpVK0yknwa0Ky9vZR8ijJ2YQkaDKbbHbd4VVcNcTz D7CSUfqTBm/fNkB1F344wnnF2kX+dTjY6rGkOhbp3bnyLCMdmhLNupcvl5RkdCptWQ+r v7viqwmyRa7FOielOpg+HeyY5YjZsEY6jwgD82ELkbyoLDzs4dp8URirI9pFnLRADwQO Q3mg== X-Gm-Message-State: AGi0PuZVhR3eCRUxR17SWptLTyI6TQT42BVWrlvg+pDCgMzxy4PLcY/Q 15LbJbdcOcuFlx4m2jbjSlc= X-Received: by 2002:a5d:6850:: with SMTP id o16mr8024101wrw.309.1587203298550; Sat, 18 Apr 2020 02:48:18 -0700 (PDT) Received: from localhost.localdomain ([2a02:2450:10d2:194d:d02f:2f6b:b441:f83]) by smtp.gmail.com with ESMTPSA id p3sm17185593wrx.82.2020.04.18.02.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 02:48:17 -0700 (PDT) From: SeongJae Park To: Mel Gorman Cc: SeongJae Park , Mel Gorman , Peter Zijlstra , "Huang, Ying" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ingo Molnar , Rik van Riel , Daniel Jordan , Tejun Heo , Dave Hansen , Tim Chen , Aubrey Li Subject: Re: Re: Re: Re: Re: [RFC] autonuma: Support to scan page table asynchronously Date: Sat, 18 Apr 2020 11:48:11 +0200 Message-Id: <20200418094811.4757-1-sj38.park@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200417144626.GA3711@suse.de> (raw) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 17 Apr 2020 15:46:26 +0100 Mel Gorman wrote: > On Fri, Apr 17, 2020 at 02:44:37PM +0200, SeongJae Park wrote: > > On Fri, 17 Apr 2020 13:16:29 +0100 Mel Gorman wrote: > > > > > On Fri, Apr 17, 2020 at 12:21:29PM +0200, SeongJae Park wrote: > > > > On Fri, 17 Apr 2020 12:04:17 +0200 Peter Zijlstra wrote: > > > > > > > > > On Fri, Apr 17, 2020 at 09:05:08AM +0200, SeongJae Park wrote: > > > > > > I think the main idea of DAMON[1] might be able to applied here. Have you > > > > > > considered it? > > > > > > > > > > > > [1] https://lore.kernel.org/linux-mm/20200406130938.14066-1-sjpark@amazon.com/ > > > > > > > > > > I've ignored that entire thing after you said the information it > > > > > provides was already available through the PMU. > > > > > > > > Sorry if my answer made you confused. What I wanted to say was that the > > > > fundamental access checking mechanism that DAMON depends on is PTE Accessed bit > > > > for now, but it could be modified to use PMU or other features instead. > > > > > > I would not be inclined to lean towards either approach for NUMA > > > balancing. Fiddling with the accessed bit can have consequences for page > > > aging and residency -- fine for debugging a problem, not to fine for > > > normal usage. I would expect the PMU approach would have high overhead > > > as well as taking over a PMU counter that userspace debugging may expect > > > to be available. > > > > Good point. But, isn't it ok to use Accessed bit as long as PG_Idle and > > PG_Young is adjusted properly? Current DAMON implementation does so, as > > idle_page_tracking also does. > > > > PG_idle and PG_young are page flags that are used by idle tracking. The > accessed bit I'm thinking of is in the PTE bit and it's the PTE that > is changed by page_referenced() during reclaim. So it's not clear how > adjusting the page bits help avoid page aging problems during reclaim. The idle tracking reads and updates not only PG_idle and PG_young, but also the accessed bit. So idle tacking was also required to deal with the interference of the reclaimer logic and thus it introduced PG_young. The commit 33c3fc71c8cf ("mm: introduce idle page tracking") explains this as below: The Young page flag is used to avoid interference with the memory reclaimer. A page's Young flag is set whenever the Access bit of a page table entry pointing to the page is cleared by writing to the bitmap file. If page_referenced() is called on a Young page, it will add 1 to its return value, therefore concealing the fact that the Access bit was cleared. DAMON adjusts PG_young in similar way to avoid the interference. DAMON further adjusts PG_idle so that it does not interfere to page idle tracking mechanism. I think I made you confused by unnecessarily mentioning PG_idle, sorry. > > Maybe your suggestion was to move NUMA balancing to use the PG_idle and > PG_young bits from idle tracking but I'm not sure what that gains us. > This may be because I did not look too closely at DAMON as for debugging > and analysis, the PMU sounded more suitable. > > It's not clear to me how looking at the page or pte bit handling of > DAMON helps us reduce the scanning cost of numa balancing. There may > be some benefit in splitting the address space and rescanning sections > that were referenced but it has similar pitfalls to simply tracking the > highest/lowest address that trapped a NUMA hinting fault. DAMON allows users to know which address ranges have which access frequency. Thus, I think DAMON could be used for detection of hot pages, which will be good migration candidates, instead of the NUMA hinting fault based referenced pages detection. The benefits I expect from this change are better accuracy and less overhead. As we can know not only referenced pages but hot pages, migration will be more effective. In terms of the overhead, DAMON allows users to set the upperbound of the monitoring overhead regardless of the size of the targe address space, unlike the page scanning based mechanisms. Thus, the overhead could be reduced, especially if the target process has large memory footprint. As I'm not deeply understanding AutoNUMA, I might saying something unrealistic or missing some important points. Thanks, SeongJae Park > > -- > Mel Gorman > SUSE Labs