Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2739910pxv; Mon, 12 Jul 2021 00:22:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPpVxjtc+bxG7y3U/Qcm1Z7XeRo2YsDdAAViLxCXLNHaKqnQPdFxJN4lvFBUmybgpM4qOc X-Received: by 2002:a05:6e02:12a6:: with SMTP id f6mr21756166ilr.123.1626074577763; Mon, 12 Jul 2021 00:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626074577; cv=none; d=google.com; s=arc-20160816; b=x6yvr2EBLk8ffUfsjfDqoP3YJr02j2KlpkSUUGVjHhujRO25CCKNqMth/zC/exKOvK MXjSziZM/8Btrfi7F6O2YoXta0EqL7okX6NCCJ05djbQLlNP+6wTqbFjX3nprTfx2iaG TKm/il2nb7VxfPCllpzqx8XceXoJ/QNj2uvXh+QBSdtO11tN3xRFf52Y86kPjbAjJszV 9MAYOxnXnX9oUdXZaxIFNKw/31FXdlec+686a7pO+vIpxuONK2wBltefhYd9mD4dMaB7 4Hu6MLPgpWHFwdL1rDiUW9rBt4ULEoJX1YmC96ccYqvTPicOY3VsuSAyyGfFGOY+nocI O19g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FNwOMLlKi66VGmHIEbOBTG2Q2a8j2sNDoQXhXFwpAR4=; b=Ft4IgRWY2EQW3S/XR9SOD049DlHaazBlWB5BHvl6QrjBl6s2AyFipKSFU+OPS2nDMf J2seAPsy8BE1U4zqrLDegEJjFQHhRkmjA5x5cnImhFzPnvZLY4Kea3m4H2x7lhUytzLT mJvAN/kbXvMsQprRrFu/snf5OOvEpkDamLoPCWdBplcPExoGFmQUsFCPq96llcaxfSxR 7UdPStqPJZ6Jqk/LxpfDVOizrepJZviKH4vS6pF72eInMf4s3vqDQyXwqg6+UrKyE4hF u6NHI7cmfWAPLK709iizUfredR5bb527e6JcsT4THzbHuBA8Gze8AIhk0+7JFWGjcX78 kR5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=IXDNvguc; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si6284512jap.90.2021.07.12.00.22.46; Mon, 12 Jul 2021 00:22:57 -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=@suse.com header.s=susede1 header.b=IXDNvguc; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344925AbhGLHVh (ORCPT + 99 others); Mon, 12 Jul 2021 03:21:37 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:57546 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240402AbhGLG4H (ORCPT ); Mon, 12 Jul 2021 02:56:07 -0400 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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