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,URIBL_BLOCKED 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 102EEC433E0 for ; Wed, 6 Jan 2021 02:57:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6C19C22D6E for ; Wed, 6 Jan 2021 02:57:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C19C22D6E 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 63E138D00D8; Tue, 5 Jan 2021 21:57:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5ECE48D00D1; Tue, 5 Jan 2021 21:57:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DBA08D00D8; Tue, 5 Jan 2021 21:57:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 343ED8D00D1 for ; Tue, 5 Jan 2021 21:57:44 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 01465362C for ; Wed, 6 Jan 2021 02:57:44 +0000 (UTC) X-FDA: 77673840048.03.use69_530eea9274de Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id D4AB328A4E8 for ; Wed, 6 Jan 2021 02:57:43 +0000 (UTC) X-HE-Tag: use69_530eea9274de X-Filterd-Recvd-Size: 5734 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 6 Jan 2021 02:57:43 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id p18so1211556pgm.11 for ; Tue, 05 Jan 2021 18:57:42 -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=lYsPdCOzqXfixaKkRPnCKU785zBOXZmL0NyzU0FFiug=; b=J1swhEHXszBFVldveCRzUAKJNVdFedOCbywLvekfqMgsECjZdRmrsFyX1vfKnc3lZg rIK1xLhRVIcSJ5kH7li+0MyJwShViyAXuIoSJn2H5l/6nvh1sPY7tUE8MLaCnWcq0HXm NDr0MjFoJVjn+jnZuT6jO0rGoUZJfNGyVXP41Vhkw0EXKVTJuKiBfmeRE/adA1l/AJRf lXBTsEkH0UFcbqwjSR7Teq9GLdHlXr80lQjCq7khfQTaP+NcSy4snVuYlswNSZQapccg xcGopoi6OTUnVwLwa4wm2WP24X0uk2tYy3UpEtdyUjBAHBtGG1XtAz/wC7qXKhX/ZhTZ l+uA== 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=lYsPdCOzqXfixaKkRPnCKU785zBOXZmL0NyzU0FFiug=; b=MA8x5G601juFrHrNr6DFuYsA6V9Nugkkur5Vy8TsBvGh8aYIi1Z3rb0hwD+KycjdCe S1bW5c+Lyp90zJY+Ya0qquEhkYEul/hDDyi/010k3F/ZWJSmuwi0ZuYmlJox8uXTNmbc cKrV0lrrubWZosU04Zs4jJ8tF2jSTerviGY4vgmWSNyR32dbpHfqvLEuNYQH02DaFj0B Gg56ZDXXfbeWRQmSx/JsEHF1pKjtjHhqZXFZOacTUi6dJ++G2RIUO0xdFRRjS56E2GuT kusvI6Mqw3zFFTdJK5VE2Dh748cFAh6Zu0JX7xLB147iFqU0eC6/hghPCBZjeY5A+2rh Ip2g== X-Gm-Message-State: AOAM532wu+ESSg89RNLg3y7Kt27Ptm6ynGbHeVv8bzqyjAcddAbgWO6K KD8zs7AjfLi3S9lfF94bDWcnDBsQP/Z4XSWVGPv5ig== X-Google-Smtp-Source: ABdhPJxmVeH2zMLxyYLVS6nxqNvd3jKCWsvP/nlla8VfJsdAUn5exKmZi9EzfE5wgDEMbM5strc+q/fgjqk209aDIu0= X-Received: by 2002:aa7:8701:0:b029:19e:561:d476 with SMTP id b1-20020aa787010000b029019e0561d476mr2144416pfo.2.1609901862076; Tue, 05 Jan 2021 18:57:42 -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> <24d35764-46b9-4234-3266-91232ac9103b@oracle.com> In-Reply-To: <24d35764-46b9-4234-3266-91232ac9103b@oracle.com> From: Muchun Song Date: Wed, 6 Jan 2021 10:57:03 +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 Wed, Jan 6, 2021 at 6:29 AM Mike Kravetz wrote: > > On 1/4/21 6:44 PM, Muchun Song wrote: > > 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? > > I'm thinking that we should export (make external) set_page_huge_active. > We can leave clear_page_huge_active as static and just add something to > the commit log noting that there are no external users. > > My primary reason for doing this is to eliminate the extra and unnecessary > per-page lock/unlock cycle. I believe there are some applications that > use fallocate to pre-allocate very large hugetlbfs files. They may notice > the extra overhead. Agree. Will do in the next version. Thanks. > -- > Mike Kravetz