Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp232559pxx; Wed, 28 Oct 2020 03:35:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuhpEV1QCTTMOMpenwetscf1mI/9MW9yP8pY78CBjatRCF6Tz1lM4BZRIe8ccrOOjnngTa X-Received: by 2002:aa7:cd42:: with SMTP id v2mr6669540edw.191.1603881310974; Wed, 28 Oct 2020 03:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881310; cv=none; d=google.com; s=arc-20160816; b=thoTyf7lwruAypCOrtYxVL+JmC6bnVENQfV4JR2IMnPq1JnUuWEtByRQA9tZGM7LXB E2laCPjiW73Vm6IIkpF6Azrgw3TTJjePe2AhEMsBCnx/bZIJGrh3S6WrJ1UxbT7a87ms DIPCIv0SYgCt8rhRYXSaVzhO1tIvSpH3tm6MaZF6FIK+2Saoykg6Gw0DReGkIyeoQfvI dwHyaEgkcUZ/OXWhv8r6oiZ5uhHqfbW3Gs5w6+fjSzFGsCg1gN88OFIjldVkL5vMG7IV FAcmnmKUMemZtSiDaWf/OuHcg61wlh12aR+eeqq2z629n0U5kBSv+7OLViSDCJqjx4Dr B3CA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xY3ezbPppqF/SoyKBsdr837uijf2BWuO2iTma0vkomE=; b=0O3Gym2eN9CneDHHz4t9csNbeCKFO/K2ZqnsrNopR9Fe7eUbZ5moXEP6TcPbl4VPeU ADNTDrjOQ4bAYJtk5GJKr3DnzGk1YOy/IJXcPpE70BGuQzoKrrdU9HJC97n3xILYdq8e 1NLMhfj6OzeMcL6VX43SOdVIyllcUYR53xgsaIN1OFSymlRzPDLM+CfNahJV8MF7uBpO Uu9rZ1Iw2O+i5pg2p/ixXclBRjA0AG9XClVloawFElEFM1swMkdy08TZcKTo96JCk71e 4Kyd+SaHuUO+m6Sh20X5ospZJlki1FmHL20wJzGTN/RuO6tpZzWHpj8TWaQU1BBeue6g DH/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0jF6j9y6; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si2705925ejr.482.2020.10.28.03.34.48; Wed, 28 Oct 2020 03:35:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=0jF6j9y6; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762624AbgJ0Onk (ORCPT + 99 others); Tue, 27 Oct 2020 10:43:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:40882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762224AbgJ0Old (ORCPT ); Tue, 27 Oct 2020 10:41:33 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DFDA21D7B; Tue, 27 Oct 2020 14:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809691; bh=tIhuQwH7xnw1zH6uRoc74A1CX0+jdIg+BwCUhy5SXLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0jF6j9y60bt/q0eqbskQnG8t4lgBW84V63QLeDp3T6Lc29oegz/iyjarFtNiv4z92 7CsgZuPx/l+FQ0PG86mRwQebOCbs536ZDoQB/PSmb0T/gAuGRrxbgmnRDzXWfDdH1h UxXOkTLpWMzkBPknsS0+tpWTPXrvNTa0yArP8fWE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Matthew Wilcox (Oracle)" , Andrew Morton , SeongJae Park , "Kirill A. Shutemov" , Huang Ying , Linus Torvalds , Sasha Levin Subject: [PATCH 5.4 254/408] mm/page_owner: change split_page_owner to take a count Date: Tue, 27 Oct 2020 14:53:12 +0100 Message-Id: <20201027135506.824352608@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox (Oracle) [ Upstream commit 8fb156c9ee2db94f7127c930c89917634a1a9f56 ] The implementation of split_page_owner() prefers a count rather than the old order of the page. When we support a variable size THP, we won't have the order at this point, but we will have the number of pages. So change the interface to what the caller and callee would prefer. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton Reviewed-by: SeongJae Park Acked-by: Kirill A. Shutemov Cc: Huang Ying Link: https://lkml.kernel.org/r/20200908195539.25896-4-willy@infradead.org Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- include/linux/page_owner.h | 6 +++--- mm/huge_memory.c | 2 +- mm/page_alloc.c | 2 +- mm/page_owner.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h index 8679ccd722e89..3468794f83d23 100644 --- a/include/linux/page_owner.h +++ b/include/linux/page_owner.h @@ -11,7 +11,7 @@ extern struct page_ext_operations page_owner_ops; extern void __reset_page_owner(struct page *page, unsigned int order); extern void __set_page_owner(struct page *page, unsigned int order, gfp_t gfp_mask); -extern void __split_page_owner(struct page *page, unsigned int order); +extern void __split_page_owner(struct page *page, unsigned int nr); extern void __copy_page_owner(struct page *oldpage, struct page *newpage); extern void __set_page_owner_migrate_reason(struct page *page, int reason); extern void __dump_page_owner(struct page *page); @@ -31,10 +31,10 @@ static inline void set_page_owner(struct page *page, __set_page_owner(page, order, gfp_mask); } -static inline void split_page_owner(struct page *page, unsigned int order) +static inline void split_page_owner(struct page *page, unsigned int nr) { if (static_branch_unlikely(&page_owner_inited)) - __split_page_owner(page, order); + __split_page_owner(page, nr); } static inline void copy_page_owner(struct page *oldpage, struct page *newpage) { diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 873de55d93fb2..9295d9d70681e 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2569,7 +2569,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, ClearPageCompound(head); - split_page_owner(head, HPAGE_PMD_ORDER); + split_page_owner(head, HPAGE_PMD_NR); /* See comment in __split_huge_page_tail() */ if (PageAnon(head)) { diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2640f67410044..c20e664866c33 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3130,7 +3130,7 @@ void split_page(struct page *page, unsigned int order) for (i = 1; i < (1 << order); i++) set_page_refcounted(page + i); - split_page_owner(page, order); + split_page_owner(page, 1 << order); } EXPORT_SYMBOL_GPL(split_page); diff --git a/mm/page_owner.c b/mm/page_owner.c index 18ecde9f45b24..83d08943bcdee 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -204,7 +204,7 @@ void __set_page_owner_migrate_reason(struct page *page, int reason) page_owner->last_migrate_reason = reason; } -void __split_page_owner(struct page *page, unsigned int order) +void __split_page_owner(struct page *page, unsigned int nr) { int i; struct page_ext *page_ext = lookup_page_ext(page); @@ -213,7 +213,7 @@ void __split_page_owner(struct page *page, unsigned int order) if (unlikely(!page_ext)) return; - for (i = 0; i < (1 << order); i++) { + for (i = 0; i < nr; i++) { page_owner = get_page_owner(page_ext); page_owner->order = 0; page_ext = page_ext_next(page_ext); -- 2.25.1