Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp995708pxu; Wed, 16 Dec 2020 22:30:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0gLdCf/JMPl7kkklWF50N419k0N6Kr/xmom80TWE/gHsmhBOpoPpLVNXyhghQMwJpVVOr X-Received: by 2002:a17:906:3712:: with SMTP id d18mr34849269ejc.178.1608186656760; Wed, 16 Dec 2020 22:30:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608186656; cv=none; d=google.com; s=arc-20160816; b=vlfDaK82W004PkfPPje/nmKPTBnzWIgDTmqHFMNFhkNsstPAP3KZWdD4D+UsxmW/QY zHsfEwOvAHHJesOt5if+P5dboHfjEVQtFsz0vr6wJdjWRvBQo7TNR+JitbTfmr0JeFXf Ew7wT4kgCZgRb8esHQ1ISNdNK2HTs03woT6cHin4fhwyJakK4ml7tCMj90xAYjw0uVdp vbhqmf3ljO549pnYcsMNZOQDnkWP7otR59JANsrGwBVw69w3DCVPh8iV1/A5dtD/j6oI 4/nn8oMu+qDrkO8mEf9FiISBCIQTn8g9IK9aJsL4d4ZAogT23kAhLx380g1kmWGkGlZh puVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=yRfAOZvUYLofPXEGdMfO2jSGtQvehCdK7fwKLyw32gE=; b=0da/Y3vaSwHOz6SCNE97VK179MlamxwDSEkCElTONkJQGCAI744bolRCoL1gPcFMn1 n9ByCHUj5tRNUNLWHRCEw4zoQsTJWH3jp+oMojdpWe8GJ5zVg+e0xwE8bndz3FN72Hh8 UbvDmdNiEqPppZxlZKyedqW5i6Z4uOMZzDcHpHSM+to3BkhtzhHgOAV9dziyrSvU3K44 BbcgXVKWRfFWUYzhMe6K5rvJ431Coxl5oH6Wn+zj0dijUYEOyexB3BjiwlNk5JLfjAwo QeFJPbW+gWuzblOkWdLUEz/D29cai6RJcvbUcA4Bs3EAFbTttoIhHgnWTBcwdiS3sXhi JORQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si4311188edv.493.2020.12.16.22.30.33; Wed, 16 Dec 2020 22:30:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727073AbgLQG3q (ORCPT + 99 others); Thu, 17 Dec 2020 01:29:46 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:50590 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbgLQG3q (ORCPT ); Thu, 17 Dec 2020 01:29:46 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UItliQ7_1608186540; Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UItliQ7_1608186540) by smtp.aliyun-inc.com(127.0.0.1); Thu, 17 Dec 2020 14:29:01 +0800 From: Alex Shi To: akpm@linux-foundation.org Cc: Hugh Dickins , Johannes Weiner , Michal Hocko , Vladimir Davydov , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mm/memcg: remove rcu locking for lock_page_lruvec function series Date: Thu, 17 Dec 2020 14:28:51 +0800 Message-Id: <1608186532-81218-2-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1608186532-81218-1-git-send-email-alex.shi@linux.alibaba.com> References: <1608186532-81218-1-git-send-email-alex.shi@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rcu_read_lock was used to block memcg destory, but with the detailed calling conditions, the memcg won't gone since the page is hold. So we don't need it now, let's remove them to save locking load in debugging. Signed-off-by: Alex Shi Cc: Hugh Dickins Cc: Johannes Weiner Cc: Michal Hocko Cc: Vladimir Davydov Cc: Andrew Morton Cc: cgroups@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/memcontrol.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e6b50d068b2f..98bbee1d2faf 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1356,10 +1356,8 @@ struct lruvec *lock_page_lruvec(struct page *page) struct lruvec *lruvec; struct pglist_data *pgdat = page_pgdat(page); - rcu_read_lock(); lruvec = mem_cgroup_page_lruvec(page, pgdat); spin_lock(&lruvec->lru_lock); - rcu_read_unlock(); lruvec_memcg_debug(lruvec, page); @@ -1371,10 +1369,8 @@ struct lruvec *lock_page_lruvec_irq(struct page *page) struct lruvec *lruvec; struct pglist_data *pgdat = page_pgdat(page); - rcu_read_lock(); lruvec = mem_cgroup_page_lruvec(page, pgdat); spin_lock_irq(&lruvec->lru_lock); - rcu_read_unlock(); lruvec_memcg_debug(lruvec, page); @@ -1386,10 +1382,8 @@ struct lruvec *lock_page_lruvec_irqsave(struct page *page, unsigned long *flags) struct lruvec *lruvec; struct pglist_data *pgdat = page_pgdat(page); - rcu_read_lock(); lruvec = mem_cgroup_page_lruvec(page, pgdat); spin_lock_irqsave(&lruvec->lru_lock, *flags); - rcu_read_unlock(); lruvec_memcg_debug(lruvec, page); -- 2.29.GIT