Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp1458194pxw; Sun, 10 Apr 2022 03:01:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzNk87SI/5q07+ircYs9bXIvvUKOzKNbDsNkftZ5ABZrdqPh4N2hrqWMZSQ5g8pCOVagca X-Received: by 2002:a17:903:2ca:b0:156:f1cc:7cb6 with SMTP id s10-20020a17090302ca00b00156f1cc7cb6mr20698612plk.174.1649584860188; Sun, 10 Apr 2022 03:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649584860; cv=none; d=google.com; s=arc-20160816; b=M/fEUKPxOljGZd3pkZ572LpZfEFf0IBJ+ZiB08FSWchnhrRcKvh1p3S5YBJCnZZQkB 5h/Yen5mTZ55hOAoYCH8Q55Qu300/InT/bXLXeOppy1VM/jVqNTQ/6LeRP3FQgkqIi7e /wKIimCf59SWqOWXsCQqE7Ff7nZ7C+tgIlhclonkeUntdNMeCPUWXcq6LByFRbMrPHzV A4/Io+tpNmxv55MZN/HkiF5K+564H3gJhxQ57C5GoDWYeqlsH5HYVMt6oG0taoRQ4HUk VDqj9/qgojUevpxxjGudi1bvO57X7McB2vylcD+hxUwA8CydfRXj8XCHilYirqhUeYmh f+xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=efZ43dT57FHPF2tAi2hrdLD6oRJSmnVYES6d06HxVfY=; b=LxsZouI6+o6UaniVg+DvCt74q8Q4IjO7O+asnUwvHJK8zz1MvWzsNIMTb0P9ZAvHIP wj0KmhbuNBRvoHPFppZ/4nqa9jF13TjYAxXCVOH/G6oy0dsIAEMBL8Nil94uk350k3Pm TlJPIJXL0gJK4y+1F6dc0dLrWu3HnpoC48Ez9eH3WP/mQYpQLP+xgak53Yia+0fv9f+s 0ZcIBrV9nnCCtlmg4HIQUdF/jTYwFsu8vqDEqRANJaCBAiiWh/SG/3DmGP2Wrde+Iytj g3c3IGGqL+W7osYCj7lq8StN1FDO5sZ+uShhVWaIdC+wl++Q6kMLo2xHIizmzE+Gj8MO y+rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w16-20020a17090a529000b001c67621041bsi9179353pjh.110.2022.04.10.03.00.47; Sun, 10 Apr 2022 03:01:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241360AbiDIJhB (ORCPT + 99 others); Sat, 9 Apr 2022 05:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241178AbiDIJgk (ORCPT ); Sat, 9 Apr 2022 05:36:40 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D77D3E0ADE for ; Sat, 9 Apr 2022 02:34:33 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kb8zd4hgwzgYMG; Sat, 9 Apr 2022 17:32:45 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 9 Apr 2022 17:34:31 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH v2 6/9] mm/vmscan: take all base pages of THP into account when race with speculative reference Date: Sat, 9 Apr 2022 17:34:57 +0800 Message-ID: <20220409093500.10329-7-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220409093500.10329-1-linmiaohe@huawei.com> References: <20220409093500.10329-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the page has buffers, shrink_page_list will try to free the buffer mappings associated with the page and try to free the page as well. In the rare race with speculative reference, the page will be freed shortly by speculative reference. But nr_reclaimed is not incremented correctly when we come across the THP. We need to account all the base pages in this case. Signed-off-by: Miaohe Lin --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index cc1193e320c2..53f1d0755b34 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1878,7 +1878,7 @@ static unsigned int shrink_page_list(struct list_head *page_list, * increment nr_reclaimed here (and * leave it off the LRU). */ - nr_reclaimed++; + nr_reclaimed += nr_pages; continue; } } -- 2.23.0