From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23E33C07E99 for ; Mon, 12 Jul 2021 06:53:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BD3C7613D2 for ; Mon, 12 Jul 2021 06:53:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD3C7613D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 58CD16B008A; Mon, 12 Jul 2021 02:53:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53D016B008C; Mon, 12 Jul 2021 02:53:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3DD2C6B0092; Mon, 12 Jul 2021 02:53:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 155066B008A for ; Mon, 12 Jul 2021 02:53:17 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1BEAE23E60 for ; Mon, 12 Jul 2021 06:53:16 +0000 (UTC) X-FDA: 78353019192.28.C89DC14 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf16.hostedemail.com (Postfix) with ESMTP id 91770F00008E for ; Mon, 12 Jul 2021 06:53:15 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 30F8E1FD58; Mon, 12 Jul 2021 06:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1626072794; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FNwOMLlKi66VGmHIEbOBTG2Q2a8j2sNDoQXhXFwpAR4=; b=IXDNvguctsJNRlVZYB5/iqcdnyk4ksoJh4wgcYvvL38b8rwNbkaY4dKfOL5OnDhQfvOoGQ 5yvc4yGRQrtqcLYd07XqgUI3n0eoIdPpe090BX+65Bgwo8Hd8ecuhgY1S4aAT3YL7DJGGe aaLWCt+/xHFLyzo26PEr6ZdyUAtGMyM= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D6BF5A4E93; Mon, 12 Jul 2021 06:53:13 +0000 (UTC) Date: Mon, 12 Jul 2021 08:53:13 +0200 From: Michal Hocko To: Chao Yu Cc: Mel Gorman , Matthew Wilcox , Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org Subject: Re: [f2fs-dev] [PATCH] f2fs: initialize page->private when using for our internal use Message-ID: References: <20210706091211.GR3840@techsingularity.net> <85bb893b-0dc4-5f57-23ec-3f84814b7072@kernel.org> <20210707095706.GT3840@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=IXDNvguc; spf=pass (imf16.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 91770F00008E X-Stat-Signature: 8a94qnteb9sqj3ey4c8zodep9i5jd1qi X-HE-Tag: 1626072795-459454 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: On Sat 10-07-21 16:11:38, Chao Yu wrote: > On 2021/7/7 17:57, Mel Gorman wrote: > > I think it would work but it would be preferable to find out why the > > tail page has an order set in the first place. I've looked over > > Agreed. > > > mm/page_alloc.c and mm/compaction.c a few times and did not spot where > > set_private_page(page, 0) is missed when it should be covered by > > clear_page_guard or del_page_from_free_list :( > > I didn't enable CONFIG_DEBUG_PAGEALLOC, so we will expect page private > should be cleared by del_page_from_free_list(), but I guess it only clears > the buddy's private field rather than original page's, so I added below > diff and check the dmesg, it looks stall private value in original page > will be left commonly... Let me know if I missed something? Page private should be cleared when the page is freed to the allocator. Have a look at PAGE_FLAGS_CHECK_AT_FREE. > --- > mm/page_alloc.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index a06bcfe6f786..1e7031ff548e 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1029,6 +1029,7 @@ static inline void __free_one_page(struct page *page, > unsigned long combined_pfn; > unsigned int max_order; > struct page *buddy; > + struct page *orig_page = page; > bool to_tail; > > max_order = min_t(unsigned int, MAX_ORDER - 1, pageblock_order); > @@ -1097,6 +1098,10 @@ static inline void __free_one_page(struct page *page, > > done_merging: > set_buddy_order(page, order); > + if (orig_page != page) { > + if (WARN_ON_ONCE(orig_page->private)) > + pr_info("2order:%x, origpage.private:%x", order, orig_page->private); > + } Why is this expected? Buddy allocator uses page private to store order. Whether we are merging to the freed page or coalesce it to a different page is not all that important. -- Michal Hocko SUSE Labs