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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 63DBCC07E9B for ; Mon, 5 Jul 2021 11:48:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4966161946 for ; Mon, 5 Jul 2021 11:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231364AbhGELun (ORCPT ); Mon, 5 Jul 2021 07:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbhGELun (ORCPT ); Mon, 5 Jul 2021 07:50:43 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E834C061574 for ; Mon, 5 Jul 2021 04:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EwWN7+UAKQIxLsDpSIp+JET9XMdfQgDUShXvpWDBlhk=; b=eAwDlJOBU+Tx+dEU6uv0PcpZ5Z RasJ+GroFUsGWxd2fKjoXsLzNuziTWVLUWfQutkeScELYfij7yZ7HJykLLat5dLYOcHcAvrHwDQwU W1CdwKpLbG4hh5TtyOOLcasY8ml+FqSPjWqH8XaH8/hkTt4v96+Ef5IeS+AurC8CDoczbLR9f7ubh mGx5mtZ7RbC++4TlVSaPOwifGtDvKqJWcQiiQ3oAFxNyUYBX1J/INz+UfIMpO79Tcc67eKXlrKkG5 cphdgL9rx/FDAFW4Z26AGNEqDbHAU/OgDLaArnEVfPfpK10O4WOojU0P9+IYI6yTwpEfBFK+ogBhX +itC8tLQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m0N4m-00AD6s-JQ; Mon, 05 Jul 2021 11:47:50 +0000 Date: Mon, 5 Jul 2021 12:47:48 +0100 From: Matthew Wilcox To: Chao Yu Cc: 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: <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 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. 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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 891A5C07E99 for ; Mon, 5 Jul 2021 11:51:11 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C0C461261 for ; Mon, 5 Jul 2021 11:51:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C0C461261 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1m0N82-0006f4-FI; Mon, 05 Jul 2021 11:51:10 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1m0N5S-0006ab-QZ for linux-f2fs-devel@lists.sourceforge.net; Mon, 05 Jul 2021 11:48:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=EwWN7+UAKQIxLsDpSIp+JET9XMdfQgDUShXvpWDBlhk=; b=I620tRHovsL59BuyV4GDgJOOEe CfzbT5zoRtzq9+IMM2fFRi1zB81nFICNCJU4Tq5lhoDHQbea7EGXFnuQyOOdfigBWjC+/GMQk521u lfUja9whLwcVA/Hi0ixXXs8Y4E+diBH2nenCRlOGqIu39icEdxWMti5qtE6eFt3XXnqg=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=EwWN7+UAKQIxLsDpSIp+JET9XMdfQgDUShXvpWDBlhk=; b=XLPkqBSAYksnOKPz1ODXLzBfzY VIPfa83l7o8oIabWnvW2iqdY6UhfVpHo3T9MTpwtgupTMmBzHNVts8TTXDrT/Gr+YU/SsexB7BIKw GJBzyUuAOU01oj8NiaR9mcQpnWptBzADQjBWas4sYUECG7o0oTkKlQ7p9azmAvBMk56Y=; Received: from casper.infradead.org ([90.155.50.34]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1m0N5P-00030k-IG for linux-f2fs-devel@lists.sourceforge.net; Mon, 05 Jul 2021 11:48:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EwWN7+UAKQIxLsDpSIp+JET9XMdfQgDUShXvpWDBlhk=; b=eAwDlJOBU+Tx+dEU6uv0PcpZ5Z RasJ+GroFUsGWxd2fKjoXsLzNuziTWVLUWfQutkeScELYfij7yZ7HJykLLat5dLYOcHcAvrHwDQwU W1CdwKpLbG4hh5TtyOOLcasY8ml+FqSPjWqH8XaH8/hkTt4v96+Ef5IeS+AurC8CDoczbLR9f7ubh mGx5mtZ7RbC++4TlVSaPOwifGtDvKqJWcQiiQ3oAFxNyUYBX1J/INz+UfIMpO79Tcc67eKXlrKkG5 cphdgL9rx/FDAFW4Z26AGNEqDbHAU/OgDLaArnEVfPfpK10O4WOojU0P9+IYI6yTwpEfBFK+ogBhX +itC8tLQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m0N4m-00AD6s-JQ; Mon, 05 Jul 2021 11:47:50 +0000 Date: Mon, 5 Jul 2021 12:47:48 +0100 From: Matthew Wilcox To: Chao Yu Message-ID: References: <20210705052216.831989-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1m0N5P-00030k-IG Subject: Re: [f2fs-dev] [PATCH] f2fs: initialize page->private when using for our internal use X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mm@kvack.org, Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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. _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel