From patchwork Fri Jan 15 12:49:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12022563 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 1EC9AC433E0 for ; Fri, 15 Jan 2021 12:51:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B06E4223E0 for ; Fri, 15 Jan 2021 12:51:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B06E4223E0 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 3CF3B8D0161; Fri, 15 Jan 2021 07:51:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 37D6D6B0135; Fri, 15 Jan 2021 07:51:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26D2D8D0161; Fri, 15 Jan 2021 07:51:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) by kanga.kvack.org (Postfix) with ESMTP id 0F1176B0134 for ; Fri, 15 Jan 2021 07:51:18 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CA97D180AD807 for ; Fri, 15 Jan 2021 12:51:17 +0000 (UTC) X-FDA: 77707994994.21.nut69_3c0e1952752f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id ACA2A180445EF for ; Fri, 15 Jan 2021 12:51:17 +0000 (UTC) X-HE-Tag: nut69_3c0e1952752f X-Filterd-Recvd-Size: 4571 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 12:51:16 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id i7so5945848pgc.8 for ; Fri, 15 Jan 2021 04:51:16 -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=wusSjLYakm6+Z6kCpNRodcZYujbXCjpbVczSV3qSR3o=; b=b6lkShudiFwH3nXVrpZX+gqStufxvurJdvxqDVcsPwjtLMN2djbpgCbGywiWqyrga0 M+gaefZbiLj+89pB2Ym76UEVbWAtzoIKFtD9vcTv29FSbXO2UNvefzDUeC5iGKY/o/Zv MFDBbzHCxL4A2Po1RducNPu56GgVGipGd0fA1OchQLbycyi7LY+WPaQfd5ntlO0bwOIV AH6hPW1wqlcg4Wi/nrhzdDWzT1SCAjciK6n+CUEGiuyeET5sIJmZrS19/hpDoL125GAy 77LHlv69plegW8wOEDThn4B2DE2SL7hw1wb2rDt7Xeuv1vmmGCUt8YDIJRKHzEOTUmJ9 v55Q== 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=wusSjLYakm6+Z6kCpNRodcZYujbXCjpbVczSV3qSR3o=; b=eRxilvqaP2LLDVaJ03aBDhpX0Ud4qCMv6AQoAf5k/yCIZW66kQ8QDwbHj1TI4z1B27 3J1mHnTuS8roOaJXf+w4rXRjliJM+JGsFAJP38o9WM/DvUupvoKV2E6B58Zc3KVqSakF xGKfTonqWO1OwaZ3FF9+fAELWLUwh+V732Fdeqyz7NMbq/6Thme+f/anQ7op53lKZ4sT Gg35pimgvpw32ebLgB12iTsUnKoUmO6OruJauA+2lDfpXjvgKirnvHRVAdizM1u6XykL xnxd5SAnbQt0HOBeeEBFPidzuwKAyM1ECymukR2M+qvR3vuIRrXTmtU/TSLMS64KGz9i /9bg== X-Gm-Message-State: AOAM533bWzyJx1TmahwFQxeUq5HE3URgn5i14QT6nrrTHe933tnKyej/ 3t+QDgOuXQvMCJmhLr1DRDt77A== X-Google-Smtp-Source: ABdhPJxGSYg/GU3hqllaplzUHovQRCfeeWtqx+DxFm1YmqgDcB1pUCRHVxptmFPNYm9/Rr6pzhq4hQ== X-Received: by 2002:a63:5fcf:: with SMTP id t198mr12329283pgb.226.1610715075683; Fri, 15 Jan 2021 04:51:15 -0800 (PST) Received: from localhost.localdomain ([139.177.225.247]) by smtp.gmail.com with ESMTPSA id c5sm8193600pjo.4.2021.01.15.04.51.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jan 2021 04:51:15 -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 , Yang Shi , Michal Hocko , David Hildenbrand , Oscar Salvador Subject: [PATCH v6 1/5] mm: migrate: do not migrate HugeTLB page whose refcount is one Date: Fri, 15 Jan 2021 20:49:38 +0800 Message-Id: <20210115124942.46403-2-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210115124942.46403-1-songmuchun@bytedance.com> References: <20210115124942.46403-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: All pages isolated for the migration have an elevated reference count and therefore seeing a reference count equal to 1 means that the last user of the page has dropped the reference and the page has became unused and there doesn't make much sense to migrate it anymore. This has been done for regular pages and this patch does the same for hugetlb pages. Although the likelyhood of the race is rather small for hugetlb pages it makes sense the two code paths in sync. Signed-off-by: Muchun Song Reviewed-by: Mike Kravetz Acked-by: Yang Shi Acked-by: Michal Hocko Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador --- mm/migrate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/migrate.c b/mm/migrate.c index 4385f2fb5d18..a6631c4eb6a6 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1279,6 +1279,12 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, return -ENOSYS; } + if (page_count(hpage) == 1) { + /* page was freed from under us. So we are done. */ + putback_active_hugepage(hpage); + return MIGRATEPAGE_SUCCESS; + } + new_hpage = get_new_page(hpage, private); if (!new_hpage) return -ENOMEM; From patchwork Fri Jan 15 12:49:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12022565 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 DF48CC433DB for ; Fri, 15 Jan 2021 12:51:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 98C6E221F7 for ; Fri, 15 Jan 2021 12:51:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98C6E221F7 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 3CD6A6B0135; Fri, 15 Jan 2021 07:51:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A5308D0163; Fri, 15 Jan 2021 07:51:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26CC28D0162; Fri, 15 Jan 2021 07:51:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 0F2C76B0135 for ; Fri, 15 Jan 2021 07:51:22 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D14DF824556B for ; Fri, 15 Jan 2021 12:51:21 +0000 (UTC) X-FDA: 77707995162.08.lock10_5e102412752f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id B28661819E76C for ; Fri, 15 Jan 2021 12:51:21 +0000 (UTC) X-HE-Tag: lock10_5e102412752f X-Filterd-Recvd-Size: 5406 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 12:51:21 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id my11so5480780pjb.1 for ; Fri, 15 Jan 2021 04:51:21 -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=en8qVXfeyVDqIIP8px6ejCNcDJPI30a78TjFLPR7Emo=; b=gSveUx2iscz2XVqox7kgx2aC826PqbTW5LQGAxIMyQpp1IKFTUdQhSOL2xfJrz9tcN mVbNIMy2wF24Yy0Crl8F9sdwYyMYe7OOkoZBLGaGqkH6HEoPHi/Z/K4whKyw8GHWgN64 3MMZMNnxzVeWl7xlHeRD/52qnh4l6ul6jMJHUki6yZZswJ/u2/GHCT54p2TCuj/3/ZKo 3CbjTZWuYIJFLmhVahvSyjfqHqVny9mJ05o36FtwR0lHUKa1U2ybhtXUAxTfQ36M9iB1 toYjk/EV3MFmIAGDvNnfF0vSER2eid/B3Qa0fdGZ4R0ZN53aGxq8xaE4trghArmB+nkw AYTA== 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=en8qVXfeyVDqIIP8px6ejCNcDJPI30a78TjFLPR7Emo=; b=thQTuk9o5wt9lpwQn8cXE5+miHb9YGMuwnzbyuyn6ZXWuZ2oLnWx0K0NdqlF/tydI2 ZbrNYLrBT7CmJxGmb9wQcviay4NYYN2TP6SJZsHP/qAIo4pxjSvzvQK9yynPgbs/I5a+ 3mH1SPeQdPekCU/ST7uN8Zn8cOLyM4zJa8D43AROXwhY2TVN8R62zzweQT89lcWniAEg BeJeQNUSN0bVkxvS34q0oWsSDuwcU2CO/nlVRCMhoqygEjOIZRa6tq+ST+sd8E749cSz DiAi4ySJc3CxzCckEA19zBYOMISh7y9sUHwfLRGWlGdzijNsxCz8qonq3RIBg+k+vAIv 7eMg== X-Gm-Message-State: AOAM531EPk8hD6e3ic7PNs+/o4KYigcs1cU9Tm5FqADW1xYxusu61Tpt ICJS+GxwWWaEpw0O8KLm2q5uYg== X-Google-Smtp-Source: ABdhPJxJPmVGEhmpm8RkxK2vrqONkxXaGgxb7wCpNiuTFdu5fvFVYrtOBP4aFoPAaOFsUeMFtez0Ww== X-Received: by 2002:a17:90a:17a5:: with SMTP id q34mr1679368pja.47.1610715080481; Fri, 15 Jan 2021 04:51:20 -0800 (PST) Received: from localhost.localdomain ([139.177.225.247]) by smtp.gmail.com with ESMTPSA id c5sm8193600pjo.4.2021.01.15.04.51.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jan 2021 04:51:19 -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 , Michal Hocko , Oscar Salvador , stable@vger.kernel.org Subject: [PATCH v6 2/5] mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page Date: Fri, 15 Jan 2021 20:49:39 +0800 Message-Id: <20210115124942.46403-3-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210115124942.46403-1-songmuchun@bytedance.com> References: <20210115124942.46403-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: If a new hugetlb page is allocated during fallocate it will not be marked as active (set_page_huge_active) which will result in a later isolate_huge_page failure when the page migration code would like to move that page. Such a failure would be unexpected and wrong. 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 Acked-by: Michal Hocko Reviewed-by: Mike Kravetz Reviewed-by: Oscar Salvador Cc: stable@vger.kernel.org --- 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]); From patchwork Fri Jan 15 12:49:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12022567 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 69692C433DB for ; Fri, 15 Jan 2021 12:51:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ED61E221F7 for ; Fri, 15 Jan 2021 12:51:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED61E221F7 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 9250A6B0137; Fri, 15 Jan 2021 07:51:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FD2E8D0163; Fri, 15 Jan 2021 07:51:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8121B8D0162; Fri, 15 Jan 2021 07:51:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id 6A6496B0137 for ; Fri, 15 Jan 2021 07:51:26 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3689C180AD804 for ; Fri, 15 Jan 2021 12:51:26 +0000 (UTC) X-FDA: 77707995372.07.beef98_500e00b2752f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 163D01803F9A3 for ; Fri, 15 Jan 2021 12:51:26 +0000 (UTC) X-HE-Tag: beef98_500e00b2752f X-Filterd-Recvd-Size: 7174 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 12:51:25 +0000 (UTC) Received: by mail-pf1-f182.google.com with SMTP id c79so5443832pfc.2 for ; Fri, 15 Jan 2021 04:51:25 -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=SURxKip/mYhGMjUhZ4z0ytkBtEFScnH+ZvTCaUzxn2g=; b=MAimcbY5VsTKL/RaGaw4hIl8R9xImx+LUTRLJVzSdfL7kG+q7uWjOLYNRnOA1NKImV 9CvO995egFhsKUKUSwvsjXXNCEjAgQGuO/bM9Lvssk/40vSBgY83ISDADN2s9zXvoMFM krNsjbH+OH3PZij2ap32x7TcQrhN5aOGFympAuk+/pPGSUy/2CQPC1w+fBxxK2U9B1FF oivOaww9QNpmKkjgIGQAMZLGi0IitEq3Q8rleu/VDxkel1aOzLBwXZBHVdC24m9qWrO/ LVUZ6ma90SGca09LcCN2UHAx/h1xMoQsSR16ZH+12gIyptgn+ZHtOUuBwdVldlWAmYNH kKjA== 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=SURxKip/mYhGMjUhZ4z0ytkBtEFScnH+ZvTCaUzxn2g=; b=Ran5+MhIz050ULmLUgyuWyMo4DsKm4BeH9kcoWA0lBsXJ+3tt2bVjRTBMHIcjFjx5Z sa4pFibdGF0w86nxH7+m9zn+dwJogqg1X98JexbqTodq6RB7OMk2jMyNZUzbFJKk7UzN ABJCOuOz7WWQbyoruqvhq6vsffKsRa8Y4QbVKHUTsxHHuiAPct0+nfIYvwGcBMqtG11p oVQ+OhsOoVp3YWQOZK0nY9XCw79N/ias5VoGts2fzIFhzRcqiVwNIPE1lgzSqR5VEjA6 6uUO3GBTKO1gxIVjZoNIX+dvDoWYn7xXUnAdO0LU4+rBklL7SSHMPrIHHNoRaojiAq8a hSmw== X-Gm-Message-State: AOAM533pWOSHl2Mooj1yci/melMqU2hl2A6Qj3xMykd0crgAszk2m6Yg 5NJHPj5Zg/2y6S+sWhHR5fCTzg== X-Google-Smtp-Source: ABdhPJxxYQDcef8kwkMh6J61KL1JdqF9D4h57D3AcxgVwSS/v61gjpqzyebdv++OOEWmh63fWsTZeQ== X-Received: by 2002:a62:864e:0:b029:1ab:e82c:d724 with SMTP id x75-20020a62864e0000b02901abe82cd724mr12462709pfd.9.1610715084805; Fri, 15 Jan 2021 04:51:24 -0800 (PST) Received: from localhost.localdomain ([139.177.225.247]) by smtp.gmail.com with ESMTPSA id c5sm8193600pjo.4.2021.01.15.04.51.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jan 2021 04:51:23 -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 , stable@vger.kernel.org Subject: [PATCH v6 3/5] mm: hugetlb: fix a race between freeing and dissolving the page Date: Fri, 15 Jan 2021 20:49:40 +0800 Message-Id: <20210115124942.46403-4-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210115124942.46403-1-songmuchun@bytedance.com> References: <20210115124942.46403-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: There is a race condition between __free_huge_page() and dissolve_free_huge_page(). CPU0: CPU1: // page_count(page) == 1 put_page(page) __free_huge_page(page) dissolve_free_huge_page(page) spin_lock(&hugetlb_lock) // PageHuge(page) && !page_count(page) update_and_free_page(page) // page is freed to the buddy spin_unlock(&hugetlb_lock) spin_lock(&hugetlb_lock) clear_page_huge_active(page) enqueue_huge_page(page) // It is wrong, the page is already freed spin_unlock(&hugetlb_lock) The race windows is between put_page() and dissolve_free_huge_page(). We should make sure that the page is already on the free list when it is dissolved. As a result __free_huge_page would corrupt page(s) already in the buddy allocator. Fixes: c8721bbbdd36 ("mm: memory-hotplug: enable memory hotplug to handle hugepage") Signed-off-by: Muchun Song Reviewed-by: Mike Kravetz Cc: stable@vger.kernel.org Reviewed-by: Oscar Salvador Acked-by: Michal Hocko --- mm/hugetlb.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4741d60f8955..b99fe4a2b435 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -79,6 +79,21 @@ DEFINE_SPINLOCK(hugetlb_lock); static int num_fault_mutexes; struct mutex *hugetlb_fault_mutex_table ____cacheline_aligned_in_smp; +static inline bool PageHugeFreed(struct page *head) +{ + return page_private(head + 4) == -1UL; +} + +static inline void SetPageHugeFreed(struct page *head) +{ + set_page_private(head + 4, -1UL); +} + +static inline void ClearPageHugeFreed(struct page *head) +{ + set_page_private(head + 4, 0); +} + /* Forward declaration */ static int hugetlb_acct_memory(struct hstate *h, long delta); @@ -1028,6 +1043,7 @@ static void enqueue_huge_page(struct hstate *h, struct page *page) list_move(&page->lru, &h->hugepage_freelists[nid]); h->free_huge_pages++; h->free_huge_pages_node[nid]++; + SetPageHugeFreed(page); } static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) @@ -1044,6 +1060,7 @@ static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) list_move(&page->lru, &h->hugepage_activelist); set_page_refcounted(page); + ClearPageHugeFreed(page); h->free_huge_pages--; h->free_huge_pages_node[nid]--; return page; @@ -1504,6 +1521,7 @@ static void prep_new_huge_page(struct hstate *h, struct page *page, int nid) spin_lock(&hugetlb_lock); h->nr_huge_pages++; h->nr_huge_pages_node[nid]++; + ClearPageHugeFreed(page); spin_unlock(&hugetlb_lock); } @@ -1754,6 +1772,7 @@ int dissolve_free_huge_page(struct page *page) { int rc = -EBUSY; +retry: /* Not to disrupt normal path by vainly holding hugetlb_lock */ if (!PageHuge(page)) return 0; @@ -1770,6 +1789,26 @@ int dissolve_free_huge_page(struct page *page) int nid = page_to_nid(head); if (h->free_huge_pages - h->resv_huge_pages == 0) goto out; + + /* + * We should make sure that the page is already on the free list + * when it is dissolved. + */ + if (unlikely(!PageHugeFreed(head))) { + spin_unlock(&hugetlb_lock); + cond_resched(); + + /* + * Theoretically, we should return -EBUSY when we + * encounter this race. In fact, we have a chance + * to successfully dissolve the page if we do a + * retry. Because the race window is quite small. + * If we seize this opportunity, it is an optimization + * for increasing the success rate of dissolving page. + */ + goto retry; + } + /* * Move PageHWPoison flag from head page to the raw error page, * which makes any subpages rather than the error page reusable. From patchwork Fri Jan 15 12:49:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12022569 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 95479C433E0 for ; Fri, 15 Jan 2021 12:51:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4C6CE223E0 for ; Fri, 15 Jan 2021 12:51:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C6CE223E0 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 EA2C16B0139; Fri, 15 Jan 2021 07:51:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E52FB8D0163; Fri, 15 Jan 2021 07:51:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1B238D0162; Fri, 15 Jan 2021 07:51:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id B8F986B0139 for ; Fri, 15 Jan 2021 07:51:30 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8B3001E16 for ; Fri, 15 Jan 2021 12:51:30 +0000 (UTC) X-FDA: 77707995540.15.army64_50127c02752f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 6AEE71814B0D6 for ; Fri, 15 Jan 2021 12:51:30 +0000 (UTC) X-HE-Tag: army64_50127c02752f X-Filterd-Recvd-Size: 5122 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 12:51:29 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id md11so5013215pjb.0 for ; Fri, 15 Jan 2021 04:51:29 -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=DQl8rxWhauEyHy66Vw2doPr/OoHRTcPYRf3F3cd9RBM=; b=mIsdeXyKnr21oVN3m7ahGUHzVFAL4IKQyIJWWr/FkWMmfFnnyjTZGy7xsYs5jvm/+0 2YzpGRQ3MzcBg96rpOAMkIXVw5klf4pNbHvBCUAFgR41iB1BjIoXFbr/7513Ach6TuGb tITWWoEYi3sJITZiRlZnZFGSYDIIGDyFzhjSOPTzD3BeXGHtYTBKwJYKffNEXNWGxDRK CqFaae/nb+uE2iJYLGmGJiCDG537+2wCuGux4ofJsnJgycNmpTdnUbu0rkjrQIHiPzs5 r2vyyygnUARsYpZU/Ku5P/6pLAi0k8fktPSX0pqIBId7xjvIxgZlseTLzlukS+HFLkPC NN9g== 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=DQl8rxWhauEyHy66Vw2doPr/OoHRTcPYRf3F3cd9RBM=; b=S65rNrCTKQAa21VeWcWEMJpMf81iOjOMeq9bVcdLCOdwQ2In0L1Xa7qwzie6tNGT/w ARipYRYrfAXXqgXngZGifuZskRhhou4lk82nSn8I9iUlHeigD/7fewoGeGjvIrbJNu8K zxQ0Vf8nyTDUk1mdy2YNp9uoQi7/rVDiLZcucWUoMH8zj/Lw48QlPuNpmxeBZI9YRzuA go76tccFET0Mzx2UyRl2cQ8ABpoHDXNEcJZ5khBlQ66mOudzqVF1FXUAc65h3ot4Hws+ AKlQBNNXoDPpq9/Hmq5tUBljLrQ1WA/e9qEcPCu9qEyBM3oA5F+ujo5SaBD3lDDUdUjQ VECw== X-Gm-Message-State: AOAM533GFc4FfQreDo80tyuduDi2vRW61dXwngu3k9KhCX6AIfiXBCbf 9u/Qsd3xI4kxUOlKK6v1Fqlidg== X-Google-Smtp-Source: ABdhPJxzO1F+Kc413WL6P0dby5vR8c7bqbiw7shMdYNcdj83Zo+SOzQRLU5IUoiFalgATpr8wIPwPA== X-Received: by 2002:a17:90a:3cc6:: with SMTP id k6mr10434490pjd.204.1610715089021; Fri, 15 Jan 2021 04:51:29 -0800 (PST) Received: from localhost.localdomain ([139.177.225.247]) by smtp.gmail.com with ESMTPSA id c5sm8193600pjo.4.2021.01.15.04.51.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jan 2021 04:51:28 -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 , Michal Hocko , stable@vger.kernel.org Subject: [PATCH v6 4/5] mm: hugetlb: fix a race between isolating and freeing page Date: Fri, 15 Jan 2021 20:49:41 +0800 Message-Id: <20210115124942.46403-5-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210115124942.46403-1-songmuchun@bytedance.com> References: <20210115124942.46403-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: There is a race between isolate_huge_page() and __free_huge_page(). CPU0: CPU1: if (PageHuge(page)) put_page(page) __free_huge_page(page) spin_lock(&hugetlb_lock) update_and_free_page(page) set_compound_page_dtor(page, NULL_COMPOUND_DTOR) spin_unlock(&hugetlb_lock) isolate_huge_page(page) // trigger BUG_ON VM_BUG_ON_PAGE(!PageHead(page), page) spin_lock(&hugetlb_lock) page_huge_active(page) // trigger BUG_ON VM_BUG_ON_PAGE(!PageHuge(page), page) spin_unlock(&hugetlb_lock) When we isolate a HugeTLB page on CPU0. Meanwhile, we free it to the buddy allocator on CPU1. Then, we can trigger a BUG_ON on CPU0. Because it is already freed to the buddy allocator. Fixes: c8721bbbdd36 ("mm: memory-hotplug: enable memory hotplug to handle hugepage") Signed-off-by: Muchun Song Reviewed-by: Mike Kravetz Acked-by: Michal Hocko Cc: stable@vger.kernel.org Reviewed-by: Oscar Salvador --- mm/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b99fe4a2b435..f2cef3cf1f85 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5572,9 +5572,9 @@ bool isolate_huge_page(struct page *page, struct list_head *list) { bool ret = true; - VM_BUG_ON_PAGE(!PageHead(page), page); spin_lock(&hugetlb_lock); - if (!page_huge_active(page) || !get_page_unless_zero(page)) { + if (!PageHeadHuge(page) || !page_huge_active(page) || + !get_page_unless_zero(page)) { ret = false; goto unlock; } From patchwork Fri Jan 15 12:49:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12022571 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 2802AC433E0 for ; Fri, 15 Jan 2021 12:51:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D777C221F7 for ; Fri, 15 Jan 2021 12:51:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D777C221F7 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 7ECD46B013B; Fri, 15 Jan 2021 07:51:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 779CB8D0162; Fri, 15 Jan 2021 07:51:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63D176B013F; Fri, 15 Jan 2021 07:51:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id 505696B013B for ; Fri, 15 Jan 2021 07:51:35 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 157BA1E03 for ; Fri, 15 Jan 2021 12:51:35 +0000 (UTC) X-FDA: 77707995750.20.shelf43_4f029f62752f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id EDC1F180C060F for ; Fri, 15 Jan 2021 12:51:34 +0000 (UTC) X-HE-Tag: shelf43_4f029f62752f X-Filterd-Recvd-Size: 4284 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 12:51:34 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id y12so5012603pji.1 for ; Fri, 15 Jan 2021 04:51:34 -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=+oq/pZri5P5cicdjvF/NV+dEw2QpXHjaPU5Z1WvWQMU=; b=QiizyrXVk9Caq+Dq/aCAmt2FvbOtK/UvO/5SMwa1kR6eOjgvONO+R+p4aPkgV5Chcn XwSrin4YYDiDHBwfPVC0heYZFWV11c1+egr7bUEKOLvd1AL/RU30tDvj59CvxDhwbm6X WIB+TJYvCG5p+282nlra7vHDx26nXfgS6Tuh4w/AAnl2tBE1nXAwqP763dvTzkk+EX/R nWCfyNU+vcdrWmaH8wZNerSs2GQsxiG7AG2MDWoZ4yZFr1ShDrN2ciAqTyqhw9bhEvS6 ZdZ8pXTfu4/CWCGDAWVoWN0Xq4EIx3p4N3h96/G4MiCk9ZhhX6Jk9058TPQr9uChUwaw 2nKw== 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=+oq/pZri5P5cicdjvF/NV+dEw2QpXHjaPU5Z1WvWQMU=; b=KPalch6WNQgjU130MwVugKSztm+Jif7g4CYbc3albTcLtS2/xR9Jc8ZzwhcPPKtzRg S/fl9Bc4tVwRxw8EHa2pJskE7fnHgPTymuXVZ4WjpuEIuVp8IlqxbfoqdhBSNrUpbwNt G92lt2LE+02TYPIdoih7siFvKLSrSmwLTK9XEycZ5sdbyLSOidoI6lvwiA4p6bKHSln0 4LwqOR3yKAfkxKlVviRjPJOpIhH7PL+mmt2eP0aoHUK3f71+GB95ir+whjF40WuEjxE2 0P7QSgxyzJOYIJBKPa6JG2HhXN7D1z2bFlvIw0nQ+l+3V2iRT542+TWyWRdupbAVYzr4 6uWg== X-Gm-Message-State: AOAM533GT2lDCBiGUr84VIg+lh+SIEw5EEZrWEXU4hLvYjkAk6kaZe9U h8/g5uK88cJO6P4gWhUrqG7SxA== X-Google-Smtp-Source: ABdhPJxod0INgeZhKzOkKfmLTxzpi/GXYx3l8jx7/eCcpACoBmjkXMvDlVhC3XFVyekI1Ig7/077gw== X-Received: by 2002:a17:90a:b296:: with SMTP id c22mr10718986pjr.142.1610715093829; Fri, 15 Jan 2021 04:51:33 -0800 (PST) Received: from localhost.localdomain ([139.177.225.247]) by smtp.gmail.com with ESMTPSA id c5sm8193600pjo.4.2021.01.15.04.51.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jan 2021 04:51:33 -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 , Michal Hocko , stable@vger.kernel.org Subject: [PATCH v6 5/5] mm: hugetlb: remove VM_BUG_ON_PAGE from page_huge_active Date: Fri, 15 Jan 2021 20:49:42 +0800 Message-Id: <20210115124942.46403-6-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210115124942.46403-1-songmuchun@bytedance.com> References: <20210115124942.46403-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: The page_huge_active() can be called from scan_movable_pages() which do not hold a reference count to the HugeTLB page. So when we call page_huge_active() from scan_movable_pages(), the HugeTLB page can be freed parallel. Then we will trigger a BUG_ON which is in the page_huge_active() when CONFIG_DEBUG_VM is enabled. Just remove the VM_BUG_ON_PAGE. Fixes: 7e1f049efb86 ("mm: hugetlb: cleanup using paeg_huge_active()") Signed-off-by: Muchun Song Reviewed-by: Mike Kravetz Acked-by: Michal Hocko Cc: stable@vger.kernel.org Reviewed-by: Oscar Salvador --- mm/hugetlb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f2cef3cf1f85..2d671f3743f5 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1360,8 +1360,7 @@ struct hstate *size_to_hstate(unsigned long size) */ bool page_huge_active(struct page *page) { - VM_BUG_ON_PAGE(!PageHuge(page), page); - return PageHead(page) && PagePrivate(&page[1]); + return PageHeadHuge(page) && PagePrivate(&page[1]); } /* never called for tail page */