Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4005444pxv; Mon, 5 Jul 2021 11:05:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3d0uH5rDgZIxsXc3vnKqKrWxV2xsLyeoBRPWVcoXqZIdUCmmQ0zKNlqnOz8Eds6vq+55O X-Received: by 2002:a02:6f1e:: with SMTP id x30mr13437065jab.122.1625508303296; Mon, 05 Jul 2021 11:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625508303; cv=none; d=google.com; s=arc-20160816; b=nfpx36ifNhF0F89pmOhK9kjfAyoLktYbC0+jhAgNVc/gM2UhYNKBVairIK8rypgsQk 9EaEUgnkwdQvpU+eqNUR/8INHVm7Ke543o0cXB64D4wnCvGnt75CLnMcvi9StFn8LeOB 6VdFNllh7xr6Z28jE9nCc6UGTzyKdI1zs0z1BdXA5BajjySwDrSsB0eHQCwo4XPeWx0R PyU0fOUP5RlEv7nqWZVKSARNtCH2o7fZ31ydhDDnWJVlIhTC6nVA1NoJ0MkCifhRbiZq r6vFSqLVFy/xf1jsFVZGJZgBDJK38QGtBYZWwReTcwmHaaJzVrTfBwtLz3SmUymWYigb Leqw== 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=PJSSPaXz5F0sfBoHjigYVhBx+aIf2WKFa+82vNi4bdY=; b=oq5AoDHsl3uAblgZ+wHXvzVISiTZagMQlb2bGrAtXCQqM8LXS9dG+ZLSngQZe7Vk/i GGy9aibkQ+4t6SmrOiW26yW7zwXAIssq4g/fUcJM72haXQmJQFFud5yM3pSKwqOY4neA dL22Q0rhOowg8O6jSxIrtL6T2+6DBYKFCAWHT0t3D4uP6GqNMkWBhaKRk5I3McvqbbD5 IDuZ9W6soEAa89+EHPwqWgFbP4lJliCRay7NPZsJfJav8Vpz6f8PiRIPbKrza57h8OuK GqY4WCI0LEqEkfDWhsLC0p7pTRLLuYqArnsdpA4C7mS8CjRL2KK3XNtUMLs1BeFHyk+I 6m5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FA6cdRCa; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si8470845jap.86.2021.07.05.11.04.51; Mon, 05 Jul 2021 11:05:03 -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=k20201202 header.b=FA6cdRCa; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbhGESHB (ORCPT + 99 others); Mon, 5 Jul 2021 14:07:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:43862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbhGESG7 (ORCPT ); Mon, 5 Jul 2021 14:06:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7A39E61960; Mon, 5 Jul 2021 18:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625508262; bh=SRd1GZBTCuo++RPTBqiScUUN2xrO3AaUUN5D9qs3T2g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FA6cdRCaN0Sau3UQE6S0Gp/0vlQbXFjjTVAAoo+RQ2Tpvj/TFe8y2IhFIG977C97g /X6EDRoi81LypTIHJtf2dZ+X6J1ca2Cxm6p8aGuVKddCy4NEVUpL0K5WGe4ygGR063 YEF3YhcgPEPln39h4ZJXbKrw3GZt9AiQeGBCwICuAkdeEufwiSe/Hzn9a6BCPLD4MM jPga6q5SNA2DTE0ZSMXjlX8PdNGroj6WAyguU1LKzO6W57fyZH7lc9jwe/Hb70TOgW IQDzI8jij7jKvSu9qOSAAZjDthZ2HCoh1dnRXuzA7K7oe+xB0v/LU7CsuLO95qth0s tDlf5UYJ6YyNQ== Date: Mon, 5 Jul 2021 11:04:21 -0700 From: Jaegeuk Kim To: Matthew Wilcox Cc: 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: References: <20210705052216.831989-1-jaegeuk@kernel.org> 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 07/05, Matthew Wilcox wrote: > On Mon, Jul 05, 2021 at 07:33:35PM +0800, Chao Yu wrote: > > On 2021/7/5 16:56, Jaegeuk Kim wrote: > > > On 07/05, Chao Yu wrote: > > > > On 2021/7/5 13:22, Jaegeuk Kim wrote: > > > > > We need to guarantee it's initially zero. Otherwise, it'll hurt entire flag > > > > > operations. > > > > > > > > Oops, I didn't get the point, shouldn't .private be zero after page was > > > > just allocated by filesystem? What's the case we will encounter stall > > > > private data left in page? > > > > > > I'm seeing f2fs_migrate_page() has the newpage with some value without Private > > > flag. That causes a kernel panic later due to wrong private flag used in f2fs. > > > > I'm not familiar with that part of codes, so Cc mm mailing list for help. > > > > My question is newpage in .migrate_page() may contain non-zero value in .private > > field but w/o setting PagePrivate flag, is it a normal case? > > 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); > > Now, I do see in __buffer_migrate_page() (mm/migrate.c): > > attach_page_private(newpage, detach_page_private(page)); > > but as far as I can tell, f2fs doesn't call any of the > buffer_migrate_page() paths. So I'm not sure why you're seeing > a non-zero page->private. 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?