From patchwork Wed Nov 11 20:40:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 11898507 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A47C416C0 for ; Wed, 11 Nov 2020 20:40:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28934208B8 for ; Wed, 11 Nov 2020 20:40:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sent.com header.i=@sent.com header.b="VDFMUHUe"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="WO7cVfVL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28934208B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=sent.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0CB0F6B0036; Wed, 11 Nov 2020 15:40:45 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 078B16B006E; Wed, 11 Nov 2020 15:40:44 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0E1D6B006C; Wed, 11 Nov 2020 15:40:44 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id ABA456B0036 for ; Wed, 11 Nov 2020 15:40:44 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 47202181AC9CC for ; Wed, 11 Nov 2020 20:40:44 +0000 (UTC) X-FDA: 77473306008.26.mice84_4908e4e27300 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 219411804B65A for ; Wed, 11 Nov 2020 20:40:44 +0000 (UTC) X-Spam-Summary: 1,0,0,8387c614c44d1b2e,d41d8cd98f00b204,zi.yan@sent.com,,RULES_HIT:41:355:379:541:560:800:960:973:988:989:1260:1261:1311:1314:1345:1359:1437:1513:1515:1521:1535:1543:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2731:3138:3139:3140:3141:3142:3353:3867:3870:3872:4118:4321:4605:5007:6120:6261:6653:6742:7576:8957:9010:10004:11026:11473:11658:11914:12043:12296:12438:12555:12679:12895:12986:13215:13229:13255:14096:14181:14721:21080:21324:21627:21990:30054:30064,0,RBL:64.147.123.26:@sent.com:.lbl8.mailshell.net-62.18.0.100 64.100.201.100;04ygfxjcnpo1moc65z4hoapbx9a1mocbdqycp5qj5icohaz6exf6r9k9d8dbj6c.s97juwewt1hekgrje56c5y57h57p31qaycqrjuy4u9db41e3fwzj4z343mix8w9.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:153,LUA_SUMMARY:none X-HE-Tag: mice84_4908e4e27300 X-Filterd-Recvd-Size: 7135 Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Nov 2020 20:40:43 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 5B022B43; Wed, 11 Nov 2020 15:40:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 11 Nov 2020 15:40:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=from :to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; s=fm2; bh=e2DmXMYHMkbqy Lg+bqDlVe/Knfvv9mMQFeJGw1T5RTk=; b=VDFMUHUegXKz8lI5ggnc/LZRtDOoo 4EcN06pcjMGbGGmm2696Z3q8HyQugMw4H/NEnKhaL4GN67y2E9LTsDm0LEmdFJF1 bHGSDFaUsA6uiEtw/ELZf3dagGtnuYV4+k3uoXLje7aHXJB7uLRQDVoe4xNWT4id NWYv7+Fl7qMpixcMBqSWvSkz1o/8yxD5hOyskNn2+budKYAWQq5Yftmfu/LYSqyK 6SxHNW7CvHIJD+t/679n/pF/zXdDDDwxl0hE7xx80x4G6L2gUOPkmIN338tOiJY7 omH1Ag95o9zssQHhVO6s/0I1+Y+oa1GJCL7AvwcQU1qa8llp5Nbz6u7Xg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:reply-to:subject :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=e2DmXMYHMkbqyLg+bqDlVe/Knfvv9mMQFeJGw1T5RTk=; b=WO7cVfVL Kf6OID8EvuIBRLlxwacD0XiqRBnjxV6zyv4sxMRsLI4AnFVWf/pXSod5W4b0tM46 ZPXCg2m23QPJrGhTmfp55myfP2ldMRBNq8SiAEjCr+OuksZxowHnZ1AqnwePGS47 G4TOJdyo7KTuFuV44vncUpgIy0RtE33UPbuv+fAbaMSAxna49v7WOJqPfGzKUMv0 l2zHUSng02djviihm+p7RPsY9UsssAxq3kRP3dMFC6caLQVwZUTvVUFX5kUBIJAn oe8bMIfD0lsJgf0nV9dDcGrPGEP/ef77fhgMrx3LyBiQw8tZl8/llh+6P/z2tk8U 07xK3sXkd2UzgQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvtddgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfrhgggfestdhqredtredttdenucfhrhhomhepkghiucgj rghnuceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepieejue dvueduuefhgefhheeiuedvtedvuefgieegveetueeiueehtdegudehfeelnecukfhppedu vddrgeeirddutdeirdduieegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepiihirdihrghnsehsvghnthdrtghomh X-ME-Proxy: Received: from nvrsysarch6.NVidia.COM (unknown [12.46.106.164]) by mail.messagingengine.com (Postfix) with ESMTPA id 61CD43280067; Wed, 11 Nov 2020 15:40:40 -0500 (EST) From: Zi Yan To: linux-mm@kvack.org, Matthew Wilcox Cc: "Kirill A . Shutemov" , Roman Gushchin , Andrew Morton , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Yang Shi , Michal Hocko , John Hubbard , Ralph Campbell , David Nellans , Zi Yan Subject: [RFC PATCH 3/6] mm: page_owner: add support for splitting to any order in split page_owner. Date: Wed, 11 Nov 2020 15:40:05 -0500 Message-Id: <20201111204008.21332-4-zi.yan@sent.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111204008.21332-1-zi.yan@sent.com> References: <20201111204008.21332-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 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: Zi Yan It adds a new_order parameter to set new page order in page owner. It prepares for upcoming changes to support split huge page to any lower order. Signed-off-by: Zi Yan Reviewed-by: Ralph Campbell --- include/linux/page_owner.h | 7 ++++--- mm/huge_memory.c | 2 +- mm/page_alloc.c | 2 +- mm/page_owner.c | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h index 3468794f83d2..215cbb159568 100644 --- a/include/linux/page_owner.h +++ b/include/linux/page_owner.h @@ -31,10 +31,11 @@ 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 nr) +static inline void split_page_owner(struct page *page, unsigned int nr, + unsigned int new_order) { if (static_branch_unlikely(&page_owner_inited)) - __split_page_owner(page, nr); + __split_page_owner(page, nr, new_order); } static inline void copy_page_owner(struct page *oldpage, struct page *newpage) { @@ -60,7 +61,7 @@ static inline void set_page_owner(struct page *page, { } static inline void split_page_owner(struct page *page, - unsigned int order) + unsigned int nr, unsigned int new_order) { } 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 f599f5b9bf7f..8b7d771ee962 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2459,7 +2459,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, ClearPageCompound(head); - split_page_owner(head, nr); + split_page_owner(head, nr, 1); /* See comment in __split_huge_page_tail() */ if (PageAnon(head)) { diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d77220615fd5..a9eead0e091a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3284,7 +3284,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, 1 << order); + split_page_owner(page, 1 << order, 1); } EXPORT_SYMBOL_GPL(split_page); diff --git a/mm/page_owner.c b/mm/page_owner.c index b735a8eafcdb..2b7f7e9056dc 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 nr) +void __split_page_owner(struct page *page, unsigned int nr, unsigned int new_order) { int i; struct page_ext *page_ext = lookup_page_ext(page); @@ -213,9 +213,9 @@ void __split_page_owner(struct page *page, unsigned int nr) if (unlikely(!page_ext)) return; - for (i = 0; i < nr; i++) { + for (i = 0; i < nr; i += (1 << new_order)) { page_owner = get_page_owner(page_ext); - page_owner->order = 0; + page_owner->order = new_order; page_ext = page_ext_next(page_ext); } }