From patchwork Wed Jan 6 08:47:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12001133 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 A2EDAC433E0 for ; Wed, 6 Jan 2021 08:49:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 32A262310A for ; Wed, 6 Jan 2021 08:49:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32A262310A 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 970C38D00F7; Wed, 6 Jan 2021 03:49:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F97C8D0090; Wed, 6 Jan 2021 03:49:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F3548D00F7; Wed, 6 Jan 2021 03:49:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id 62E3F8D0090 for ; Wed, 6 Jan 2021 03:49:52 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2FD21180AD806 for ; Wed, 6 Jan 2021 08:49:52 +0000 (UTC) X-FDA: 77674727424.06.body75_48144df274e0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 11CED1005636C for ; Wed, 6 Jan 2021 08:49:52 +0000 (UTC) X-HE-Tag: body75_48144df274e0 X-Filterd-Recvd-Size: 5085 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Wed, 6 Jan 2021 08:49:51 +0000 (UTC) Received: by mail-pf1-f177.google.com with SMTP id h186so1346428pfe.0 for ; Wed, 06 Jan 2021 00:49:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2O4sxrXuT0FCcMIizj5iDb7GOKunPmY/8SboAcivvpk=; b=tL0RH2+wEpb73hSGTr5n++pp7wHB2R912i/VX7pZGK9rTl/lStD7TAjFG+sgUhhd2a 6wvTSDvLPhx0zh+TOBbOhqULN6HmKhMB0f/qBHf5RBy2rJGRnuHTNQFtRU85OJADmqyM alj3qkG58MjGF5GCE8NWdQ1GHaWl8/94FO7aQgewbux+bWT+qXTQlyvirheOHevKsdZz Ezd2upXDgd4c3OdEeVcbUGgQY6niBMHT79fesO+VUV3kN/kc5UNdJPF8cj0ZpzQcnR7e NyYfHcEjO+zz01i5tYKAsXFQUTHwuVpWGT49BLEgdi/coidjeZtAkioyu91s0lHXW35t AWyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2O4sxrXuT0FCcMIizj5iDb7GOKunPmY/8SboAcivvpk=; b=kNav2eUdCVqUtkVXR5DmxkRtcNrjOgoHaYNo3eg99mkr+H2WX0QwdOLUuk1L1AOPF9 jV6/4UjjSzXKioKkYW8iOt9V+JD0AQfLBx/zZCPkkEpgSsd3bi//44dt4x20ScX/rgdL VyUxMwX77KGDdYI2kY2zSGegGAUXAPF/89BZnN++R0ncgKGOF8bTSPBXcvYUsaqisWHy +qZAJrTNWB7rgWMcii+XHNDgG+c03tzFL1Y6+Pf5u5h59xaMkvXajCMg3TA4KWJJthL0 Dqh1C1D72MklWIErMh6htt9d0Th5OtJrG1M3c2kE2k+p0U6z7E36FOP4VjFtnCBqBbuH 4SoQ== X-Gm-Message-State: AOAM532pjImCn1UdMEEJVTgyFALcYx75lxRkWpg9K50cduRxAQD52rBM tsQEuUGjKiyNw/jes4pO0rAeEg== X-Google-Smtp-Source: ABdhPJzMj0ckWNNfDTFqbQ0rHX8F9/Up1U2wEFuSO1s/Se1yI95wuu1Xwl5VTX8hRXrSbpZ9nqsSew== X-Received: by 2002:a62:7ed2:0:b029:19d:9461:2b30 with SMTP id z201-20020a627ed20000b029019d94612b30mr2914866pfc.14.1609922987055; Wed, 06 Jan 2021 00:49:47 -0800 (PST) Received: from localhost.localdomain ([139.177.225.232]) by smtp.gmail.com with ESMTPSA id h8sm1851806pjc.2.2021.01.06.00.49.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jan 2021 00:49:46 -0800 (PST) From: Muchun Song To: mike.kravetz@oracle.com, akpm@linux-foundation.org Cc: n-horiguchi@ah.jp.nec.com, ak@linux.intel.com, mhocko@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH v2 2/6] mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page Date: Wed, 6 Jan 2021 16:47:35 +0800 Message-Id: <20210106084739.63318-3-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210106084739.63318-1-songmuchun@bytedance.com> References: <20210106084739.63318-1-songmuchun@bytedance.com> MIME-Version: 1.0 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: 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. Only export set_page_huge_active, just leave clear_page_huge_active as static. Because there are no external users. Fixes: 70c3547e36f5 (hugetlbfs: add hugetlbfs_fallocate()) Signed-off-by: Muchun Song --- fs/hugetlbfs/inode.c | 3 ++- include/linux/hugetlb.h | 2 ++ mm/hugetlb.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index b5c109703daa..21c20fd5f9ee 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -735,9 +735,10 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, mutex_unlock(&hugetlb_fault_mutex_table[hash]); + set_page_huge_active(page); /* * unlock_page because locked by add_to_page_cache() - * page_put due to reference from alloc_huge_page() + * put_page() due to reference from alloc_huge_page() */ unlock_page(page); put_page(page); diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index ebca2ef02212..b5807f23caf8 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -770,6 +770,8 @@ static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, } #endif +void set_page_huge_active(struct page *page); + #else /* CONFIG_HUGETLB_PAGE */ struct hstate {}; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1f3bf1710b66..4741d60f8955 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1348,7 +1348,7 @@ bool page_huge_active(struct page *page) } /* never called for tail page */ -static void set_page_huge_active(struct page *page) +void set_page_huge_active(struct page *page) { VM_BUG_ON_PAGE(!PageHeadHuge(page), page); SetPagePrivate(&page[1]);