From patchwork Tue Jun 4 02:05:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuanchu Xie X-Patchwork-Id: 13684559 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B485513D2BF for ; Tue, 4 Jun 2024 02:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717466771; cv=none; b=Li4QIyhxw1Xo3GDNy1kiCXGb/AmQzh1qTkteorxyKm7ELXS9rb1uKdFZnN7K+u5n6aPOBM2+UgBhjQB0AYYrSgo96q/1x73xYc/Q255CPgv3Pnt1n2SQz6uJ05GxrOg/MttuSCekfWimM+X/GCX7tr4b8Jphe5KVPCpJq7/KG/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717466771; c=relaxed/simple; bh=msjeUsgEzzOjOpUWHfas3LCKMX1t6e6yDLl0uelE9mg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=k6jE5UdzMZ01CIuqJFwRqkBDifey4OcxcJbMNDtcdl6GbXMGylVFVRBMzTbboU2z8WU2IMr9B1t2pjKV9WcB8bx1w0Mhi1PyM0kY7IQmnLCreGqEg+vgvTNnyKwt/fFaZYOOoRLIIyiEZ8Td1FmVwtLLTk8Gc7cLdnI7ALkRKJw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--yuanchu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=taLOJr1h; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--yuanchu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="taLOJr1h" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a27e501d4so10189317b3.3 for ; Mon, 03 Jun 2024 19:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717466769; x=1718071569; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=TjWUm/jwk/hpgAY6bYVVdFyPbNpQM4PAlbOY34rPVUc=; b=taLOJr1helQgcs2JhlL6kdfSnGBKeG/3LVHEiZ9Vdl5nRWjTl5YAUPzrEnyV9eehYF Lxvqu8GQguXVjnt+E+h3sKyGTdazv6oYbh8jbATK48mqlft9bxuGvXpzkMlcyxx0SnvY uK3Fo+k11KYaD5fnNdh0XSdJXpm0XxUECkpBf5a9g/8WjBtjJH7prgII0v8mCsdMx+sB 6HOcbPdetq7ONLQaH6i/lEDQVMtbHmv66iCpffsbl3f64k351lwEFGmYo0KLSjcYCVLu Y26QnOD9lh4PL5F7kOCHx3MAeDrCH9lAaXONfMbsCVOuGbF2hygVxJUi0b9fw26gH59t xUdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717466769; x=1718071569; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TjWUm/jwk/hpgAY6bYVVdFyPbNpQM4PAlbOY34rPVUc=; b=q+0nNYScRcTeSNuB3qy2xI0ys6NbxfJZjWC7CGUmObR9Dq5q9nD+pRxKwMsaQF4QQF cPNZ1ezrJ/Iuf4RLKCSa0+pzTYHzcLcqmQkmTB4wL5ysy5H9fNWGZcRfJkRRRfza7lwO sirfHW59XK8NfXwE54iEopJB1qcjMMCA946T1TPvslSL23YPVCrXVtvtgzsP3r++tZ/0 9otzU5U5/tyBnbfxbCp3zOuXlvWS/e8jP8O/c8/+QQEXF4VgnYxbpUG/ZccPnSPv/hAD Xy//mrta4Zq5yCIefIYXNuHhetGS7otd0iPih655z9KrFdMHXluw6E7fzNIeGnM1voqs 6YQw== X-Forwarded-Encrypted: i=1; AJvYcCWavg2lxePbPWC5ro7ICVZ0E1SwiBgSgsMsAtCDvlNARtuM1BBgnwpe1Zyhfg9puqCdBMFS5FvdJ7egSAKYgwRKeA5aBV03A3PtOJVuBFBz X-Gm-Message-State: AOJu0Yz2LP1MnbV5M0889RJzP6uvn8i+zOLFlz5bam0nyl979oeL/BGX uUC1Ztwed2VpH5V+OkfLUvu4CCIMVFrtU20ORTLqsmmD8xfXwLl+fckSyZkw1Dxwqcss89WAmpG tKLw73w== X-Google-Smtp-Source: AGHT+IEDfb+3JEeKpiUuy5LGS6SnXp9v414pUptf89nU5rjiLVpz5pdRpN0kM4+F2bCDbN9n10wQa2F2tJMo X-Received: from yuanchu-desktop.svl.corp.google.com ([2620:15c:2a3:200:367f:7387:3dd2:73f1]) (user=yuanchu job=sendgmr) by 2002:a05:6902:110d:b0:df1:d00c:130c with SMTP id 3f1490d57ef6-dfa73bf59bcmr1176974276.5.1717466768619; Mon, 03 Jun 2024 19:06:08 -0700 (PDT) Date: Mon, 3 Jun 2024 19:05:42 -0700 In-Reply-To: <20240604020549.1017540-1-yuanchu@google.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240604020549.1017540-1-yuanchu@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240604020549.1017540-2-yuanchu@google.com> Subject: [PATCH v2 1/8] mm: multi-gen LRU: ignore non-leaf pmd_young for force_scan=true From: Yuanchu Xie To: David Hildenbrand , "Aneesh Kumar K.V" , Khalid Aziz , Henry Huang , Yu Zhao , Dan Williams , Gregory Price , Huang Ying , Muhammad Usama Anjum Cc: Kalesh Singh , Wei Xu , David Rientjes , Greg Kroah-Hartman , "Rafael J. Wysocki" , Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Shuah Khan , Yosry Ahmed , Matthew Wilcox , Sudarshan Rajagopalan , Kairui Song , "Michael S. Tsirkin" , Vasily Averin , Nhat Pham , Miaohe Lin , Qi Zheng , Abel Wu , "Vishal Moola (Oracle)" , Kefeng Wang , Yuanchu Xie , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org When non-leaf pmd accessed bits are available, MGLRU page table walks can clear the non-leaf pmd accessed bit and ignore the accessed bit on the pte if it's on a different node, skipping a generation update as well. If another scan occurrs on the same node as said skipped pte. the non-leaf pmd accessed bit might remain cleared and the pte accessed bits won't be checked. While this is sufficient for reclaim-driven aging, where the goal is to select a reasonably cold page, the access can be missed when aging proactively for workingset estimation of a of a node/memcg. In more detail, get_pfn_folio returns NULL if the folio's nid != node under scanning, so the page table walk skips processing of said pte. Now the pmd_young flag on this pmd is cleared, and if none of the pte's are accessed before another scan occurrs on the folio's node, the pmd_young check fails and the pte accessed bit is skipped. Since force_scan disables various other optimizations, we check force_scan to ignore the non-leaf pmd accessed bit. Signed-off-by: Yuanchu Xie --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index d55e8d07ffc4..73f3718b33f7 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3548,7 +3548,7 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end, walk->mm_stats[MM_NONLEAF_TOTAL]++; - if (should_clear_pmd_young()) { + if (!walk->force_scan && should_clear_pmd_young()) { if (!pmd_young(val)) continue;