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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,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 2F189C433E0 for ; Tue, 5 Jan 2021 02:45:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 795B622573 for ; Tue, 5 Jan 2021 02:45:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 795B622573 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 985BD6B00FE; Mon, 4 Jan 2021 21:45:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 936FB6B0100; Mon, 4 Jan 2021 21:45:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8252F6B0101; Mon, 4 Jan 2021 21:45:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 681AE6B00FE for ; Mon, 4 Jan 2021 21:45:16 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 26BE91EE6 for ; Tue, 5 Jan 2021 02:45:16 +0000 (UTC) X-FDA: 77670179832.06.crook45_3b08cef274d5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 0550710049710 for ; Tue, 5 Jan 2021 02:45:16 +0000 (UTC) X-HE-Tag: crook45_3b08cef274d5 X-Filterd-Recvd-Size: 4923 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 5 Jan 2021 02:45:15 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id z12so827366pjn.1 for ; Mon, 04 Jan 2021 18:45:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4yUElh54ziqvnaYw/lR3NMZ3F3Mtb4o6tzGU6Ylom2Q=; b=DujKVO3d2mCQEEZxErsU9lpPFJgvhxlKBJ+QIpDglKDdEb0504AGv46al434FwKvWo A1Y/U4gAZ0ByNCedkRGfgxHw1BZyF51U/YBbBqVXKMizT1Qtt+mPGhB2BMZtDLZ2qUz5 XbYCqYULiAag0MDrcQpee67LsH9LZHnTKohm5f40wL7eKWe8l9ZekWJOOO4HRMTM9bMw sd54braeYGnSOBqAsl3g2Vx0ZmV739Y61uOBE48JqpJy7bmLo4svzcKc9M08QsUWJhCk tgiIiYKy9STr1M/LDjrVSifX2xnxhnehe/QXJdHadbbq9MvdCJ0pFfnkNqUv6eZnR/gW uwiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4yUElh54ziqvnaYw/lR3NMZ3F3Mtb4o6tzGU6Ylom2Q=; b=j85h5dqwTkwBdqi7xb1HraakSHaGnaQGDCl2WktXdt/WD95qDFC8xQTHeuaOOL34E+ mH5bfihQbiMztnUrMZ/MP/VW18cWQs7yrknyzX+fA6Qp+SyHdL01alBrGwFUfSFUeufL DSAl7n9VEq/p3adHxLXpvOuXrn+fwJIh7M3debAT4atAUJoyyQGr41i/xM7EkOQb0HrX 7xiXtzq0vHk4e1B3tBGm3Qywqe1H8bryT/leAABUy2oU6fiatxTo7zAgoWJ8Ha9lRygh tqjlD5KBuVypdWpgkYQb4gdsk5LdIDP4GEICc6xVcdqW81/D/4dQc0ynqCaVmbzZa/sk jRrA== X-Gm-Message-State: AOAM5303RpjTxa35471+CyydsYFDdIl/sAdfV5aTQOU+VGVoI17DI55E 5tVaT1KhvZcACNvfXakvDwmKKV6FhNsstkY2K6fleA== X-Google-Smtp-Source: ABdhPJz9xOghcVpQzvTTeiTfKR7cGivJL60nU4siI92Q6vDRRcW64XOS/SIVpSgSGNE5LBraooDw69ZDRa02nwo0cYE= X-Received: by 2002:a17:90a:5405:: with SMTP id z5mr1948803pjh.13.1609814714345; Mon, 04 Jan 2021 18:45:14 -0800 (PST) MIME-Version: 1.0 References: <20210104065843.5658-1-songmuchun@bytedance.com> <20210104065843.5658-2-songmuchun@bytedance.com> <09be227a-4e16-1960-c8e9-609c35a80ef5@oracle.com> In-Reply-To: <09be227a-4e16-1960-c8e9-609c35a80ef5@oracle.com> From: Muchun Song Date: Tue, 5 Jan 2021 10:44:35 +0800 Message-ID: Subject: Re: [External] Re: [PATCH 2/6] hugetlbfs: fix cannot migrate the fallocated HugeTLB page To: Mike Kravetz Cc: Andrew Morton , Naoya Horiguchi , Andi Kleen , mhocko@suse.cz, Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" 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 Tue, Jan 5, 2021 at 6:40 AM Mike Kravetz wrote: > > On 1/3/21 10:58 PM, Muchun Song wrote: > > Because we only can isolate a active page via isolate_huge_page() > > and hugetlbfs_fallocate() forget to mark it as active, we cannot > > isolate and migrate those pages. > > > > Fixes: 70c3547e36f5 (hugetlbfs: add hugetlbfs_fallocate()) > > Signed-off-by: Muchun Song > > --- > > fs/hugetlbfs/inode.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > Good catch. This is indeed an issue. > > > > > diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c > > index b5c109703daa..2aceb085d202 100644 > > --- a/fs/hugetlbfs/inode.c > > +++ b/fs/hugetlbfs/inode.c > > @@ -737,10 +737,11 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, > > > > /* > > * unlock_page because locked by add_to_page_cache() > > - * page_put due to reference from alloc_huge_page() > > + * put_page() (which is in the putback_active_hugepage()) > > + * due to reference from alloc_huge_page() > > Thanks for fixing the comment. > > > */ > > unlock_page(page); > > - put_page(page); > > + putback_active_hugepage(page); > > I'm curious why you used putback_active_hugepage() here instead of simply > calling set_page_huge_active() before the put_page()? > > When the page was allocated, it was placed on the active list (alloc_huge_page). > Therefore, the hugetlb_lock locking and list movement should not be necessary. I agree with you. Because set_page_huge_active is not exported (static function). Only exporting set_page_huge_active seems strange (leaving clear_page_huge_active not export). This is just my opinion. What's yours, Mike? Thanks. > > -- > Mike Kravetz > > > } > > > > if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) > >