Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4664671pxu; Mon, 21 Dec 2020 19:51:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2bSJ1HH9lLBijWZkMyU2aLENHQHqGNU7aC+QSfwEf0QJyO7PnP20RcV39gWfsKS1xjHvB X-Received: by 2002:aa7:df0f:: with SMTP id c15mr18893821edy.354.1608609083478; Mon, 21 Dec 2020 19:51:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608609083; cv=none; d=google.com; s=arc-20160816; b=RMftXi6ca48/J2wY4BzHOlCI1skpVXKji/TSPUActuTnuJl+a/oDBqVxYsoz+mu2Qx e3oBys3UuMA/CtiSF0v1RY/F31RtPwkwFhG9vPTWYiJEo6AH+erTyovSd3UpnkJ9NeB5 MCe/9C0ohki2QY10LMUwiBGKeP1zlkTBu7RxY4yIneH4dV1Vo2vFicm+MxddUIzUD2Zg iljC1C4FLXnW/HsJkiU2J5pgEI9nor029Sp993PAslVm5aBbIP031p0Ck1yaTWxpg2Ra 3Jg3hvzVLzT9h+bs2Kaqf/9fTpLDRVYaEMqkXIgHRt3x2ZwJZjmU/Hd4QhLmh1V00vje a5Pg== 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=tdbzTUr3Pw+6/KahxCTYW+sU0lmWimxwgvACiw9JQC4=; b=fAFEHONNKaq4lVE8Ed3BsXhSl8enLto0JsehYe7PbJOKojALXoOU+Sx5kBe06DAHKx ajMCEbvr5FiUTI6R+oDwqZkAnPJ5Bv+KhExcespFIbClrR6XeJCuDN0a6HeCverXMRCT HRqovWYNQPWdCJtYbok5zcq+TU79RvLV4Ck+0gQ+bDJmukn1ODaIuUnArnMvre8twJeJ GDcymrc8xKwa0RUkiLbTK9RV6htAL4FaJFAu1UsgCf7lr9ftQ7O0PFDDZ0mhmdTyPLYx O9iT791bLmYfgdJR6qZDZiob3bvwxX0Wr4wVi9SX1/QbqpdikjLY29P+i8lX3CYalzb5 eWlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ah+5ws13; 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 v4si13022831edi.191.2020.12.21.19.51.00; Mon, 21 Dec 2020 19:51:23 -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=@google.com header.s=20161025 header.b=Ah+5ws13; 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 S1725972AbgLVDuG (ORCPT + 99 others); Mon, 21 Dec 2020 22:50:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbgLVDuG (ORCPT ); Mon, 21 Dec 2020 22:50:06 -0500 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D787AC0613D3 for ; Mon, 21 Dec 2020 19:49:25 -0800 (PST) Received: by mail-oo1-xc2f.google.com with SMTP id x23so2693898oop.1 for ; Mon, 21 Dec 2020 19:49:25 -0800 (PST) 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=tdbzTUr3Pw+6/KahxCTYW+sU0lmWimxwgvACiw9JQC4=; b=Ah+5ws13d8qEq+zKY2YxfDFxNB/pkPb8TPI5D2Jb66/8ljWGfpt0/vBhscSxCYIM3M pHDyJ18A3QaQg0ysMehXTMPrEPkryCt3HGYUSG0ege4TWudhwtvz+JUm9GolsgQgu/A7 gO5Yb20kiNXJ71NQi+yBYFyi4RzGS0WrPBTjgQIkFERQsPU5a59rJDM6bBWUU5O2UUHO IpmOj54GadwxljRncz62G+D5rL+B4Ui5xiryTJpnATsEGpobjt0TYOKNB3jsDBeM08du U7mz8wiFxtNkTYo7HDY+czagkcsfiG+fX3bynidHNLj1Fw01a4tjlqefZYMp5EFRnB6Y vLtQ== 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=tdbzTUr3Pw+6/KahxCTYW+sU0lmWimxwgvACiw9JQC4=; b=Bu6gcK+czZ68Gg5zSUyjYhetcnZpVyWkM6gN9qcNJBOgNBI7Eg/AfjpAEFUUcQfqZe 2qD7/wvlgw9SW38lkCRpV5qDm6Kfqci6PIUha4iXGWRKn+Xn2xqL9XVDHnMLxz/HMErd 1ycQTJ9mZprUOVtdQOJ5a4mqTmKSpru56ZIOrqjqMYq+wYH+RYaFIiQJpFEE239Dt1OC JZzovdVgrqWaGfu6yW/Vyq9h3Ebv1CAT3qcB1d/XjS1oF/jSbugNhe20lczxgHyhiIjd 3RZWuK5EplycEa9PaZvyVYiT8Fl5n7eE57Pas4hWQas92ZQpDaSG1SWGvJpC9djoJLFL igrg== X-Gm-Message-State: AOAM532l0wBAFYHZ156CI6v2QrVplB58p8t5CuHcs6GoQNgl2YLzgtZf BK3hb7UT3ApDAO44PASUO3/dDg== X-Received: by 2002:a4a:81:: with SMTP id 123mr13729306ooh.46.1608608964904; Mon, 21 Dec 2020 19:49:24 -0800 (PST) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id r25sm4312600otp.23.2020.12.21.19.49.23 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Mon, 21 Dec 2020 19:49:24 -0800 (PST) Date: Mon, 21 Dec 2020 19:49:22 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Alex Shi cc: Andrew Morton , Hugh Dickins , Johannes Weiner , Alexander Duyck , Hui Su , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] mm/compaction: remove rcu_read_lock during page compaction In-Reply-To: <1608186532-81218-3-git-send-email-alex.shi@linux.alibaba.com> Message-ID: References: <1608186532-81218-1-git-send-email-alex.shi@linux.alibaba.com> <1608186532-81218-3-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 Thu, 17 Dec 2020, Alex Shi wrote: > rcu_read_lock was used to guard memcg destory, now TestClearPageLRU > could block this happen, so we don't need it. Remove it to reduce > locking load in debugging mode. " isolate_migratepages_block() used rcu_read_lock() with the intention of safeguarding against the mem_cgroup being destroyed concurrently; but its TestClearPageLRU already protects against that. Delete the unnecessary rcu_read_lock() and _unlock(). " > > Signed-off-by: Alex Shi > Cc: Hugh Dickins Acked-by: Hugh Dickins > Cc: Johannes Weiner > Cc: Andrew Morton > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org > --- > mm/compaction.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index 8049d3530812..02af220fb992 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -995,7 +995,6 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > if (!TestClearPageLRU(page)) > goto isolate_fail_put; > > - rcu_read_lock(); > lruvec = mem_cgroup_page_lruvec(page, pgdat); > > /* If we already hold the lock, we can skip some rechecking */ > @@ -1005,7 +1004,6 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > > compact_lock_irqsave(&lruvec->lru_lock, &flags, cc); > locked = lruvec; > - rcu_read_unlock(); > > lruvec_memcg_debug(lruvec, page); > > @@ -1026,8 +1024,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > SetPageLRU(page); > goto isolate_fail_put; > } > - } else > - rcu_read_unlock(); > + } > > /* The whole page is taken off the LRU; skip the tail pages. */ > if (PageCompound(page)) > -- > 2.29.GIT