Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp90565pxb; Mon, 16 Aug 2021 00:15:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzudkDZPwr3mNJA11II+VoI/ohU0nF12jk8Q6mgSD5watpxPyT0cROtQHLZPUPvKxJl0D+S X-Received: by 2002:a5e:a813:: with SMTP id c19mr4803256ioa.199.1629098110013; Mon, 16 Aug 2021 00:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629098110; cv=none; d=google.com; s=arc-20160816; b=RQHeUOrxhjKWppAHFfRA4xEcAbzat8ulEhjw+LKptiEnLtANMNs06pR+US9CuhQgxG sD9yte3GVtyx32C3ZtwZWFhEGEcJjtLivUnQ3yf5xH57wfs6LyOdoueNVsn40El15nSS CVglKq5I/nE+UKSFyy7j41Yet65eLEavXDsug5GrvAjATzBQqNbIuNrrWwj9g0gJKlk+ XsoyzpifSuXl29AJHZDYzYDLsl/sLlEpCeE5JOK/Qgd1B1SLXbWqnq4IBF4ksMFZY0P3 QOrQEOp+XdO+8jFSWdKgX75RfTTR9Q4M4C4Ek5iFG/NWoJXZP0sPyWC94yalGj21l6vM UrNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=vZKLAgh42r6jS46PBr4w+g9gS6pDN0tcMN69/hUsV5s=; b=qgzSTOZ9PLlQlcKdW9ZaLulNnJB4pLcSdswJEiLx8mVDo0GhFelIHOHAidmD1uuSXD DjrMsguDW8X/Vgjym3zzKDbStmb4aC2gOFlQsF9lb0Rdh55oOV+y71Xh7NaZdpRTMgwh 9cKREsR1rxbKr13j2sc49Z/oG5ULuU5weSBRINaf+tKQwfc3rY+6z9VNpSbY298DZfak 8cAk6cxOz2mhI0enTsw40xfVPZmpiRmuMYt1wMeWU6rusuds6ll6TF5NDmMhxlIFIIJP b/tLq1RRWLtV8JXn3dRcZYSpzdPvc5wUEawdPPjbZ/t/jb6Zb9xYOqQMRGr204fbeAUA LrJw== 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j9si10703946ilr.97.2021.08.16.00.14.59; Mon, 16 Aug 2021 00:15:09 -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; 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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234273AbhHPHNh (ORCPT + 99 others); Mon, 16 Aug 2021 03:13:37 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:13324 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbhHPHNW (ORCPT ); Mon, 16 Aug 2021 03:13:22 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Gp52z6xdZz86X8; Mon, 16 Aug 2021 15:12:43 +0800 (CST) Received: from dggema756-chm.china.huawei.com (10.1.198.198) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 16 Aug 2021 15:12:49 +0800 Received: from localhost.localdomain (10.175.112.125) by dggema756-chm.china.huawei.com (10.1.198.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 16 Aug 2021 15:12:48 +0800 From: Chen Huang To: Roman Gushchin , Muchun Song , "Wang Hai" , Greg Kroah-Hartman CC: , , , Chen Huang , Michal Hocko , Vladimir Davydov , "Xiongchun Duan" , Andrew Morton , Linus Torvalds Subject: [PATCH 5.10.y 07/11] mm: memcontrol: change ug->dummy_page only if memcg changed Date: Mon, 16 Aug 2021 07:21:43 +0000 Message-ID: <20210816072147.3481782-8-chenhuang5@huawei.com> X-Mailer: git-send-email 2.18.0.huawei.25 In-Reply-To: <20210816072147.3481782-1-chenhuang5@huawei.com> References: <20210816072147.3481782-1-chenhuang5@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema756-chm.china.huawei.com (10.1.198.198) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Muchun Song Just like assignment to ug->memcg, we only need to update ug->dummy_page if memcg changed. So move it to there. This is a very small optimization. Link: https://lkml.kernel.org/r/20210319163821.20704-5-songmuchun@bytedance.com Signed-off-by: Muchun Song Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt Cc: Michal Hocko Cc: Roman Gushchin Cc: Vladimir Davydov Cc: Xiongchun Duan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Chen Huang --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d45c2c97d9b8..73418413958c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6907,6 +6907,7 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug) uncharge_gather_clear(ug); } ug->memcg = page_memcg(page); + ug->dummy_page = page; /* pairs with css_put in uncharge_batch */ css_get(&ug->memcg->css); @@ -6920,7 +6921,6 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug) else ug->pgpgout++; - ug->dummy_page = page; page->memcg_data = 0; css_put(&ug->memcg->css); } -- 2.18.0.huawei.25