From patchwork Thu Sep 15 02:40:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 12976786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6545ECAAD3 for ; Thu, 15 Sep 2022 02:42:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E5E286B0071; Wed, 14 Sep 2022 22:42:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DBDD08D0002; Wed, 14 Sep 2022 22:42:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5EF18D0001; Wed, 14 Sep 2022 22:42:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AFCD96B0071 for ; Wed, 14 Sep 2022 22:42:05 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 88249C05E3 for ; Thu, 15 Sep 2022 02:42:05 +0000 (UTC) X-FDA: 79912770210.11.9FFFBC1 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by imf24.hostedemail.com (Postfix) with ESMTP id 3D6521800C9 for ; Thu, 15 Sep 2022 02:42:03 +0000 (UTC) Received: from SHSend.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTPS id 28F2fEuC020951 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Thu, 15 Sep 2022 10:41:14 +0800 (CST) (envelope-from zhaoyang.huang@unisoc.com) Received: from bj03382pcu.spreadtrum.com (10.0.74.65) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Thu, 15 Sep 2022 10:41:13 +0800 From: "zhaoyang.huang" To: Andrew Morton , Zhaoyang Huang , , , Subject: [PATCHv2] mm: No need to check pcp page when free it to buddy Date: Thu, 15 Sep 2022 10:40:54 +0800 Message-ID: <1663209654-14727-1-git-send-email-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.0.74.65] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 28F2fEuC020951 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663209725; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references; bh=yr8Joowaa1fvNynJChgU5bb4jQCq1FQ6daeUx/9fAN4=; b=vC/tUKL1wzspV1fWrGwA0ci4ehxkbd+2oH8JzYPBL8xx4I5UB//vUzKiGatndJwynYDleZ +ddtvXhX1qQ2oLvSIvEP/LtQZ0HdreGkLyQPAUYavW0HOY7rIqb0U7FDXHaBLpW3qbhpo5 tgZ/oWMzrwBhfWGUJ0/wHBmTtGYN9UQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf24.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663209725; a=rsa-sha256; cv=none; b=boXD89Wzitb6z+EIeUq0e3+52WKW6M+VOvO2c0LlEUgL5+4bNSf5dVNTK9nJjkB5JtThga hs5tVvg5vqDQhD9zKht3TCeRHiU7ravkDU932NWnAj7Ge2r24NoqZ2+46BJb+6i1oiOqWS r68Ozzl+fsH51xF1uwUgn2IA7+caPFc= Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf24.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 3D6521800C9 X-Stat-Signature: t1fgwbbnm3n8egh7n5ibznmixsn9g1b1 X-HE-Tag: 1663209723-69852 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Zhaoyang Huang The pages on pcp list have been checked the validity via bellowing call chain. It is no need to check it again when free them back to buddy by free_pcppages_bulk. free_unref_page\free_unref_page_list { ... //page's validity is checked here if (!free_unref_page_prepare(page, pfn, order)) return; ... //page added to pcp->lists and status is ready for moving to buddy list_add(&page->lru, &pcp->lists[pindex]); Signed-off-by: Zhaoyang Huang --- v2: update code and comment for clarifying --- --- mm/page_alloc.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e008a3d..1472ebc 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1420,14 +1420,6 @@ static bool free_pcp_prepare(struct page *page, unsigned int order) { return free_pages_prepare(page, order, true, FPI_NONE); } - -static bool bulkfree_pcp_prepare(struct page *page) -{ - if (debug_pagealloc_enabled_static()) - return check_free_page(page); - else - return false; -} #else /* * With DEBUG_VM disabled, order-0 pages being freed are checked only when @@ -1442,11 +1434,6 @@ static bool free_pcp_prepare(struct page *page, unsigned int order) else return free_pages_prepare(page, order, false, FPI_NONE); } - -static bool bulkfree_pcp_prepare(struct page *page) -{ - return check_free_page(page); -} #endif /* CONFIG_DEBUG_VM */ /* @@ -1512,9 +1499,6 @@ static void free_pcppages_bulk(struct zone *zone, int count, count -= nr_pages; pcp->count -= nr_pages; - if (bulkfree_pcp_prepare(page)) - continue; - /* MIGRATE_ISOLATE page should not go to pcplists */ VM_BUG_ON_PAGE(is_migrate_isolate(mt), page); /* Pageblock could have been isolated meanwhile */