Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3755349pxk; Tue, 22 Sep 2020 01:28:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2RlEsC7E8c/qimodm7hDAWdecuthTsmw5HMyVcO96sZN6lvSvInj77IKC7QbnT6KmfRrh X-Received: by 2002:a17:906:8297:: with SMTP id h23mr3551448ejx.383.1600763307569; Tue, 22 Sep 2020 01:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600763307; cv=none; d=google.com; s=arc-20160816; b=d5qxqO5iNbE7Sq4k2CTE2fAfJ4uwbC2NvmjlIUUJtDsfLc8xOTyVRZJRQziuxIc5Gc 4nfqJxRFqKhGJDo8qGeZwUVWroMmlQK76ELR8KhvYFrjlidEb13xOyc078KvWoumuv3o 9ouB9KIWl6MOPSf2B9H7HIEdwR9DMEOkkncOmnL6nZGwArH+1nQbVLEslBsRTM1wEngJ 1I+MX0UfcW+KBVBQHJV6WiptIsya2M/Ofl3vY7PmPgNREpXGy6ggCCgT/8PFWuPYWRf9 kpVivbcupSJqc5mh702/U9VsgbfUGcXgiJVjldNmdj1KyUOP6AO+pKE3QPx4ZljuPDzQ +f4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=VqM0C5aizd06EEJhbPcKDGQSZnlrNdjhm1j3MXU1V80=; b=UQMA6YnwB8Pecy3ObmnLWq5IowzMP1tZtW0IYgrYr6ic0F9NszQaX1zJmxfFYBg1Z9 F3opMlj1GwY6y66vGGPbT14A2qxN3I078kqctTcdi2tQDAj+8irJwEQ7UVANmELtsify 1RoB6MH1pKsMPGB64Efwyy8H9q9g8vgZ7olUK7T0jmmA6HQOUCeVX9wglGz3axqSxeso qLe5QQTTAf+Al7KTcerqpC6p7vFyaoN4mA+ikD5VmxSE/+tzWGqoTyHIaYmzpWCSDitZ zKsJ7sjtqurkYlWQtbVjCRNbjUx6vZKh3OnCxuimXbfg3YKBraCFko81tzZsfLGOkzhG 8oug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OCgfz6fy; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf25si11328788ejb.67.2020.09.22.01.28.04; Tue, 22 Sep 2020 01:28:27 -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=@google.com header.s=20161025 header.b=OCgfz6fy; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728416AbgIVFoV (ORCPT + 99 others); Tue, 22 Sep 2020 01:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727522AbgIVFoV (ORCPT ); Tue, 22 Sep 2020 01:44:21 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC6AC061755 for ; Mon, 21 Sep 2020 22:44:21 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id v20so19788372oiv.3 for ; Mon, 21 Sep 2020 22:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=VqM0C5aizd06EEJhbPcKDGQSZnlrNdjhm1j3MXU1V80=; b=OCgfz6fy1qQPxVmz3FNoiB4+LRJSLY2XeCFt6IARQmhRwm/sfZYsUv+N4gUa7j3oe0 iI8TK21X75WMXgA/oWIHyWGLTVX/UyWjTkPygXM01E7XHpWRo1ksBgMPlf6Dg2LTWkut 8iVQ/GrKomUCJyx+l5lRaIE9kijzB/RlhSJMgIA5jx2wW0Ik0QWJxo3N068QOeg7LJ8A xca37W+dQsM7pfSykEykegXvuqOnWYf1COCWncsk7ZO8g3gHy7/n1mB0L71KWd2nAjAq FmIbVNw/01E9uWvCkYQKreyCjuFeQVtKvYJsbZ4UBJSf6QGj6yO5Kh/S9VcryWOQJlC5 Vikw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=VqM0C5aizd06EEJhbPcKDGQSZnlrNdjhm1j3MXU1V80=; b=J6wcII5w69VS+RKCILbszgDmiE5rfxx0OCqVV93PgbsFABdRZagszV4efEzugxvKsh C0fY70RJO5FB682HxJZaNPkWIq9m5XeTdNW7xKZdlaFD6B1otJ72NERjKHEskjl9y1xf G1ps4O284ztwvdsPVyy2dqkT2JMZGi8tlUEV3MW3UQgBI2EdqVGmRt4YCbOfpkAD5oBU elN+WndX6FUd55d10KYXLrrrhVWQ+OKTj/NepEu2UEwmv0B02fW3riYEQhVhzFP1sqer 06j5g2QbZob0NWZBtfaTi3iQwVXiF2TGCH+lDVe5P+UZUFFtRxDFw7LwFdVRQRasO6Db RVxw== X-Gm-Message-State: AOAM533uO44AOqMFhIdNzagnAKpgMheSOqcTc+VESohBVxzyuj9IcF3A 1VwO2qDkBgviYyZKnBGoAvRINQ== X-Received: by 2002:aca:d9c2:: with SMTP id q185mr1715051oig.28.1600753460499; Mon, 21 Sep 2020 22:44:20 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id c19sm8114703ooq.35.2020.09.21.22.44.17 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Mon, 21 Sep 2020 22:44:19 -0700 (PDT) Date: Mon, 21 Sep 2020 22:44:16 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Alex Shi cc: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, willy@infradead.org, hannes@cmpxchg.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com, kirill@shutemov.name, alexander.duyck@gmail.com, rong.a.chen@intel.com, mhocko@suse.com, vdavydov.dev@gmail.com, shy828301@gmail.com, Andrey Ryabinin , Jann Horn Subject: Re: [PATCH v18 22/32] mm/vmscan: use relock for move_pages_to_lru In-Reply-To: <1598273705-69124-23-git-send-email-alex.shi@linux.alibaba.com> Message-ID: References: <1598273705-69124-1-git-send-email-alex.shi@linux.alibaba.com> <1598273705-69124-23-git-send-email-alex.shi@linux.alibaba.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Aug 2020, Alex Shi wrote: > From: Hugh Dickins > > Use the relock function to replace relocking action. And try to save few > lock times. > > Signed-off-by: Hugh Dickins > Signed-off-by: Alex Shi > Reviewed-by: Alexander Duyck NAK. Who wrote this rubbish? Oh, did I? Maybe something you extracted from my tarball. No, we don't need any of this now, as explained when going through 20/32. > Cc: Andrew Morton > Cc: Tejun Heo > Cc: Andrey Ryabinin > Cc: Jann Horn > Cc: Mel Gorman > Cc: Johannes Weiner > Cc: Matthew Wilcox > Cc: Hugh Dickins > Cc: cgroups@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: linux-mm@kvack.org > --- > mm/vmscan.c | 17 ++++++----------- > 1 file changed, 6 insertions(+), 11 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 2c94790d4cb1..04ef94190530 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -1848,15 +1848,15 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, > enum lru_list lru; > > while (!list_empty(list)) { > - struct lruvec *new_lruvec = NULL; > - > page = lru_to_page(list); > VM_BUG_ON_PAGE(PageLRU(page), page); > list_del(&page->lru); > if (unlikely(!page_evictable(page))) { > - spin_unlock_irq(&lruvec->lru_lock); > + if (lruvec) { > + spin_unlock_irq(&lruvec->lru_lock); > + lruvec = NULL; > + } > putback_lru_page(page); > - spin_lock_irq(&lruvec->lru_lock); > continue; > } > > @@ -1871,12 +1871,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, > * list_add(&page->lru,) > * list_add(&page->lru,) > */ > - new_lruvec = mem_cgroup_page_lruvec(page, page_pgdat(page)); > - if (new_lruvec != lruvec) { > - if (lruvec) > - spin_unlock_irq(&lruvec->lru_lock); > - lruvec = lock_page_lruvec_irq(page); > - } > + lruvec = relock_page_lruvec_irq(page, lruvec); > SetPageLRU(page); > > if (unlikely(put_page_testzero(page))) { > @@ -1885,8 +1880,8 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, > > if (unlikely(PageCompound(page))) { > spin_unlock_irq(&lruvec->lru_lock); > + lruvec = NULL; > destroy_compound_page(page); > - spin_lock_irq(&lruvec->lru_lock); > } else > list_add(&page->lru, &pages_to_free); > > -- > 1.8.3.1