Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4495477pxv; Tue, 6 Jul 2021 02:15:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymlqgFg4MQTDuz5yUDML6B37uEOu0wm0+l+noCBpK24zyCU00Ln+JnhMT3RdEsC7vI7Jky X-Received: by 2002:a05:6402:2552:: with SMTP id l18mr22016604edb.363.1625562945996; Tue, 06 Jul 2021 02:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625562945; cv=none; d=google.com; s=arc-20160816; b=sCI/os0AWu7pJvacCe/W6FBObD6n6x2zo0dfYbDawhMz8d2Be51cue7iim0BGAeFAZ QqyQXKYGhinsnzBh9RSxMKuoS6TubIrOeKyzjMHg0fARpy0/UJhp52lfUIYcVoxFhZyb UfQ/wrHF0Oz/QWQ1fV/i8xiVAipPJsy5LB6vHKptTKhDNgg4SEYlkuYOUHBryNX0T6rR Kcd2I4qjIGMS7VAoBatAkQ9jblSBKVc5mXZpHKGQor6UsMax0n3plvpbJKlwa04MyuMI Q83IASrSerkwphCdSYb7aKpOW6roKp9B1ySp8quPmNKlkCbrI4SvqW4mzjJ9DdlvzBpg bI2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=+FYBuLn9sPaVyFv6yMeNu3tpSPQuRAZZofS8wKS2V0M=; b=lFzbtsME4YvT+2p0FIcvX3jNnEuv7rp9oDn6Mk/m/NGksgzf6RWudl6bj8l5EkcO15 8zrKEcP94zdzX2riOQvmz42ZdZhW3DFc6JaCrq5iQf+tLIJIJhx1N7y9UvhbY3GI380E 3A1gLpfPAHOU9NDvTWPETaMQCVyhlLAeviKrXhA2tmMYvQWgpbXb9agDONFH1WaDHvgn mCg5HLzFD44pwS/LOge7JFG/eo8P6QsknTIePPEeZKI8oICW5/F2TGAnoFprAS580euT xTENYKFa/8J5+a0dIN9f7qYh4Tj5Jsp57oiWSyFILnRmQ3XzqcC/Z/5aq/H4Of5Wll51 RVIA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si17182293ejz.520.2021.07.06.02.15.22; Tue, 06 Jul 2021 02:15:45 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231159AbhGFJOw (ORCPT + 99 others); Tue, 6 Jul 2021 05:14:52 -0400 Received: from outbound-smtp21.blacknight.com ([81.17.249.41]:42290 "EHLO outbound-smtp21.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbhGFJOv (ORCPT ); Tue, 6 Jul 2021 05:14:51 -0400 Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp21.blacknight.com (Postfix) with ESMTPS id 9CBFE18E069 for ; Tue, 6 Jul 2021 10:12:12 +0100 (IST) Received: (qmail 24893 invoked from network); 6 Jul 2021 09:12:12 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.255]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 6 Jul 2021 09:12:12 -0000 Date: Tue, 6 Jul 2021 10:12:11 +0100 From: Mel Gorman To: Matthew Wilcox Cc: Jaegeuk Kim , Chao Yu , 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: <20210706091211.GR3840@techsingularity.net> References: <20210705052216.831989-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 05, 2021 at 07:45:26PM +0100, Matthew Wilcox wrote: > On Mon, Jul 05, 2021 at 11:04:21AM -0700, Jaegeuk Kim wrote: > > On 07/05, Matthew Wilcox wrote: > > > I think freshly allocated pages have a page->private of 0. ie this > > > code in mm/page_alloc.c: > > > > > > page = rmqueue(ac->preferred_zoneref->zone, zone, order, > > > gfp_mask, alloc_flags, ac->migratetype); > > > if (page) { > > > prep_new_page(page, order, gfp_mask, alloc_flags); > > > > > > where prep_new_page() calls post_alloc_hook() which contains: > > > set_page_private(page, 0); > > > > Hmm, I can see it in 4.14 and 5.10 kernel. > > > > The trace is on: > > > > 30875 [ 1065.118750] c3 87 f2fs_migrate_page+0x354/0x45c > > 30876 [ 1065.123872] c3 87 move_to_new_page+0x70/0x30c > > 30877 [ 1065.128813] c3 87 migrate_pages+0x3a0/0x964 > > 30878 [ 1065.133583] c3 87 compact_zone+0x608/0xb04 > > 30879 [ 1065.138257] c3 87 kcompactd+0x378/0x4ec > > 30880 [ 1065.142664] c3 87 kthread+0x11c/0x12c > > 30881 [ 1065.146897] c3 87 ret_from_fork+0x10/0x18 > > > > It seems compaction_alloc() gets a free page which doesn't reset the fields? > > I'm not really familiar with the compaction code. Mel, I see a call > to post_alloc_hook() in split_map_pages(). Are there other ways of > getting the compaction code to allocate a page which don't go through > split_map_pages()? I don't *think* so but I didn't look too hard as I had limited time available before a meeting. compaction_alloc calls isolate_freepages and that calls split_map_pages whether fast or slow isolating pages. The problem *may* be in split_page because only the head page gets order set to 0 but it's a bad fit because tail pages should be cleared of private state by del_page_from_free_list. It might be worth adding a debugging patch to split_pages that prints a warning once if a tail page has private state and dump the contents of private to see if it looks like an order. -- Mel Gorman SUSE Labs