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=-17.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 CA5F7C433DB for ; Tue, 5 Jan 2021 22:29:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6114F22E00 for ; Tue, 5 Jan 2021 22:29:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6114F22E00 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7DAFC8D00B6; Tue, 5 Jan 2021 17:29:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 78B8F8D006E; Tue, 5 Jan 2021 17:29:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 679AA8D00B6; Tue, 5 Jan 2021 17:29:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 4E8A58D006E for ; Tue, 5 Jan 2021 17:29:34 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0400D181AEF15 for ; Tue, 5 Jan 2021 22:29:34 +0000 (UTC) X-FDA: 77673164268.02.mom01_54035c5274dc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id DB3AD10097AA0 for ; Tue, 5 Jan 2021 22:29:33 +0000 (UTC) X-HE-Tag: mom01_54035c5274dc X-Filterd-Recvd-Size: 6281 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 5 Jan 2021 22:29:33 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 105MPmPG022645; Tue, 5 Jan 2021 22:29:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=wXVdrBUbSRT99XPEF5wQND4MuLbgCVx8TLN5Nwz7Y7s=; b=opeT4ikT4Jz/FnPretW7uujdJlohEpnNNTAZUp6w7gRUn3rIFTFKV4JP6y75bageQAyT 79LJ3+dIgkPFAnadAJPozYu8v5eO/7x5xk8zbx8geajt3ofSBOlnLKftpKCq9JdnNlZb +cTXjzeJjvHTvg7vixMj2jSWf9wNHjVPInbnc162J4h4kwIdQIGhdvciuLBFDwUNrnW+ uxV2/paXqTVy6nRBusel/oMojQ4ySjgviO/LAcw8dKkAmMrckyjJeC1YgovO1+8qj6Mm XxM+zcJElJoxS9CZTtMsMHIcane268YFRFUiiq50QepdPKceqkQdl/FvHUGykwkSSkh8 Jw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 35tgsku1h9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 05 Jan 2021 22:29:27 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 105MTGgd168756; Tue, 5 Jan 2021 22:29:27 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 35v1f95jnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Jan 2021 22:29:25 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 105MR9Yq017456; Tue, 5 Jan 2021 22:27:09 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Jan 2021 14:27:09 -0800 Subject: Re: [External] Re: [PATCH 2/6] hugetlbfs: fix cannot migrate the fallocated HugeTLB page To: Muchun Song Cc: Andrew Morton , Naoya Horiguchi , Andi Kleen , mhocko@suse.cz, Linux Memory Management List , LKML References: <20210104065843.5658-1-songmuchun@bytedance.com> <20210104065843.5658-2-songmuchun@bytedance.com> <09be227a-4e16-1960-c8e9-609c35a80ef5@oracle.com> From: Mike Kravetz Message-ID: <24d35764-46b9-4234-3266-91232ac9103b@oracle.com> Date: Tue, 5 Jan 2021 14:27:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9855 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050129 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9855 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 malwarescore=0 phishscore=0 impostorscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050129 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 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. -- Mike Kravetz