From patchwork Sun Sep 18 20:47:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12979591 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 AEFE2C6FA82 for ; Sun, 18 Sep 2022 20:48:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 471D194000F; Sun, 18 Sep 2022 16:48:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35D1C940008; Sun, 18 Sep 2022 16:48:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BA1D94000F; Sun, 18 Sep 2022 16:48:12 -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 06C29940008 for ; Sun, 18 Sep 2022 16:48:12 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D8603A03C1 for ; Sun, 18 Sep 2022 20:48:11 +0000 (UTC) X-FDA: 79926393582.18.63DB261 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf04.hostedemail.com (Postfix) with ESMTP id 8D1A640007 for ; Sun, 18 Sep 2022 20:48:11 +0000 (UTC) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-34a03cb9679so66693717b3.21 for ; Sun, 18 Sep 2022 13:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date; bh=D5bqFcM02ok2Op9XffwMYvsMuGuxkAbvMVE2W4HraDE=; b=TuDIfV7XafYybhVc761tfvG9sZFGTpi7Z8r9tEqHNPVEXnmpLRIenytt+RetlqRrKs mf88Piy3neW7vqCl474V/f+fZ0orMw6pjtedVlOocOA5EKDXfDjHcUieCjP9WSBX/Yju I8GdCFCyNlr9GmLbqAG9lzOiRmCM00SZzhdFBQ3EWWSZSecmHrP8zHgQRRZmAzH/704m 6sJEt54coI+D0qeZ8ufdG8q9uEIjvPRXdVLlZmPx6AttrOqXcCGor8Gq07/LqLZ+ACsB o50zXl3bhSZ91zW9DIJODMOWLRlRn8Hru0YByEotUQVpIeQFp0E4AHaK2yVMQfebrDSw xshg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=D5bqFcM02ok2Op9XffwMYvsMuGuxkAbvMVE2W4HraDE=; b=Fz7lfbg1M3XOXgkuwYwNYUPTKP3ldfp6IuACNtRMII7U4MdJeensFuHXxAGCBtJWju 1RjpKrCyif+fUy1p4VqS/lGQAhGS8+QSLTT42Bs9h3yMlR2VJK+ouOCeq/jvOjWmSZt+ uy3s0d7v10oemYSUWU//IEdqeBSrksHOo6SNtkVAarxszmIZfsEOOTDCNAfc5Kyr1NKS i/BXQdC8m3CsGuUVVnJySEzTfoZjWYAEf5v0c2xBt4heOrLS8Srhvv3e5RmCOwnaOji4 dEnHbaJbHAQbRvktp7DqjV4VsGeCwTV7gUfWIchmtBhZEcWUFOADXm9WGhm/mdwFqS5d f2Tg== X-Gm-Message-State: ACrzQf0Z/3CV42zmtQ5dvEcveknQ8VnR2ovAbtddffjhLp4pxu8jYjL8 8FjXUEnkCmvFVV83fRyIUJWK38a9Vx4= X-Google-Smtp-Source: AMsMyM7VeW75cNZqfLRi0jskMtexUZEuaL+tNX+J26vrr0HuZQg0eIjJXeqHSwz5wdE1Ck7zGF8tY1AFf0M= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:ccff:7b62:4ed6:2946]) (user=yuzhao job=sendgmr) by 2002:a25:7784:0:b0:6ab:4853:e6f9 with SMTP id s126-20020a257784000000b006ab4853e6f9mr12909970ybc.476.1663534090968; Sun, 18 Sep 2022 13:48:10 -0700 (PDT) Date: Sun, 18 Sep 2022 14:47:53 -0600 In-Reply-To: <20220918204755.3135720-1-yuzhao@google.com> Message-Id: <20220918204755.3135720-9-yuzhao@google.com> Mime-Version: 1.0 References: <20220918204755.3135720-1-yuzhao@google.com> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog Subject: [PATCH v14-fix 09/11] mm: multi-gen LRU: add comment in lru_gen_look_around() From: Yu Zhao To: Andrew Morton Cc: linux-mm@kvack.org, Yu Zhao ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663534091; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=D5bqFcM02ok2Op9XffwMYvsMuGuxkAbvMVE2W4HraDE=; b=d1A5+1zMZtFtP4cUkByHmY0pcHvNeCo45MYlRUc9ijQHciVLW6JbDz1uiPHRx1lfiV6kL3 UPMjQ089lblxp3iUkd5CGyh5UP5fF5T1ucWyPVTuiDcTuPpHA7EoIPd+wYUtBGOdnlegyo T1ZzxmTo/782xlyEeB//1tYYRf3vsB4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=TuDIfV7X; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf04.hostedemail.com: domain of 3CoQnYwYKCM8JFK2v919916z.x97638FI-775Gvx5.9C1@flex--yuzhao.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3CoQnYwYKCM8JFK2v919916z.x97638FI-775Gvx5.9C1@flex--yuzhao.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663534091; a=rsa-sha256; cv=none; b=3TAq5AECX231zgfwuHrC0SN5k6nn2mhYziZLFdXomvfJhKASlRNDpo36TSapfOGRO8+WMQ N/nNEEC3GViOlVwOt14hDyQWVQ1HUbtUKUXoQeXE6nDPZhItnPk4nVOFd2lp2f+p8w9j08 rSrI0I/RzaIVz985f41zVsWN209leH4= X-Stat-Signature: eusdejqn1ap585jqfdg4qwwtpmunmhtw X-Rspamd-Queue-Id: 8D1A640007 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=TuDIfV7X; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf04.hostedemail.com: domain of 3CoQnYwYKCM8JFK2v919916z.x97638FI-775Gvx5.9C1@flex--yuzhao.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3CoQnYwYKCM8JFK2v919916z.x97638FI-775Gvx5.9C1@flex--yuzhao.bounces.google.com X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1663534091-969012 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: Signed-off-by: Yu Zhao --- mm/vmscan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 1c5c357bee42..f6eab73bdfb9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4604,6 +4604,9 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw) if (spin_is_contended(pvmw->ptl)) return; + /* avoid taking the LRU lock under the PTL when possible */ + walk = current->reclaim_state ? current->reclaim_state->mm_walk : NULL; + start = max(pvmw->address & PMD_MASK, pvmw->vma->vm_start); end = min(pvmw->address | ~PMD_MASK, pvmw->vma->vm_end - 1) + 1; @@ -4619,7 +4622,6 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw) } pte = pvmw->pte - (pvmw->address - start) / PAGE_SIZE; - walk = current->reclaim_state ? current->reclaim_state->mm_walk : NULL; rcu_read_lock(); arch_enter_lazy_mmu_mode();