From patchwork Tue Mar 30 20:38:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12173659 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.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,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 7B048C433DB for ; Tue, 30 Mar 2021 20:39:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D860C61968 for ; Tue, 30 Mar 2021 20:39:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D860C61968 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 67A8C6B0080; Tue, 30 Mar 2021 16:39:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62A7E6B0081; Tue, 30 Mar 2021 16:39:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CBAD6B0082; Tue, 30 Mar 2021 16:39:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0114.hostedemail.com [216.40.44.114]) by kanga.kvack.org (Postfix) with ESMTP id 30DA96B0080 for ; Tue, 30 Mar 2021 16:39:05 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DF8A9180AD820 for ; Tue, 30 Mar 2021 20:39:04 +0000 (UTC) X-FDA: 77977705008.21.A7149E4 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf16.hostedemail.com (Postfix) with ESMTP id 00ABD80192DA for ; Tue, 30 Mar 2021 20:39:03 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id x21-20020a17090a5315b029012c4a622e4aso61869pjh.2 for ; Tue, 30 Mar 2021 13:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oULrbP4FjkNs256uwHNb2TcGOaX/Icewt8+s6vnPbs0=; b=VmLIRhG9Yo8Bz7DBKSnLIY7XdqRlJlnUEhdK5Tl7ArdufNhr8MevNPAqItT/BSeg5k 9TtEBrFSloigP+swEWB9/e6K8VKbZMCksz2Hg/DkYr1SDuRH9gCHjGYuHeFyiGmjf2/W i0IsbASLP69oP6W8E6kWbqcz8neHS8FF04rNSXsClvlOqnwZMIy63NKxExdwp38TIeGE oHyQ+85R0anm0uEsMyo0GgDMK+ljITtvnwjeZO/ObxDXhjU6lJJC280l6oL0vgoJIBM2 pslwzEsWH+WBFGFEvt3/EMrTzeZJZheYEAdPuV6O6YA4Ynr9HjKNJlzPvzDLIkctoNpA MBbg== 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:mime-version :content-transfer-encoding; bh=oULrbP4FjkNs256uwHNb2TcGOaX/Icewt8+s6vnPbs0=; b=Xx7iRgUrGqnt2zJAWR5RyMB8cbJuCYaTon1dZIWS9iC8XQxCk29XMt92oQIuH7+Jmr ig9FJYVF+14xw7sVQNBJslIJXeQSVXNgOKDOeG9Ec0ITDZwaaindt/W5YlDmo0qs1dSa rlodGuvjEpUzF2bFg5KaMJz6VIgd7jf+pe3PQxainxZre2Wk+l7WbvUENE5axB7DVRda NeA7/gOMDagzkGLBzpybzMtGcCB/MLkDadOy/K2qa9OylMgDcR4pJ7ZBa/Q3QnF6lszz +ha+0OMAVjaFsjRbznoiu/FyFlfZMsI3tDLPhQ8yTujYojO7PIIao3/PP9PpkCM0XAOg LkxQ== X-Gm-Message-State: AOAM531UT5es7TQ1RDLT7XwY3LrYZzPshrBu/116s6AiDXIKlYOjREcf wspNl6MI+jXLQxq8X8aHtpc= X-Google-Smtp-Source: ABdhPJxDyrO5CqmvnF5c4G+4akGsOBnpUlKQ4rBDZKu5yugGoY03lh9Ri2hRr51gq3S0AHAnjsGhqg== X-Received: by 2002:a17:90b:1c0e:: with SMTP id oc14mr132796pjb.188.1617136743504; Tue, 30 Mar 2021 13:39:03 -0700 (PDT) Received: from localhost.localdomain (c-73-93-239-127.hsd1.ca.comcast.net. [73.93.239.127]) by smtp.gmail.com with ESMTPSA id c26sm10442321pfo.97.2021.03.30.13.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 13:39:02 -0700 (PDT) From: Yang Shi To: jhubbard@nvidia.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [v2 PATCH] mm: gup: remove FOLL_SPLIT Date: Tue, 30 Mar 2021 13:38:59 -0700 Message-Id: <20210330203900.9222-1-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 00ABD80192DA X-Stat-Signature: hck1em49tdt7uroksz76519o4g7gdgfj Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf16; identity=mailfrom; envelope-from=""; helo=mail-pj1-f50.google.com; client-ip=209.85.216.50 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617136743-562593 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: Since commit 5a52c9df62b4 ("uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT") and commit ba925fa35057 ("s390/gmap: improve THP splitting") FOLL_SPLIT has not been used anymore. Remove the dead code. Reviewed-by: John Hubbard Signed-off-by: Yang Shi Reviewed-by: Jason Gunthorpe --- v2: Remove the reference in documentation. Documentation/vm/transhuge.rst | 5 ----- include/linux/mm.h | 1 - mm/gup.c | 28 ++-------------------------- 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/Documentation/vm/transhuge.rst b/Documentation/vm/transhuge.rst index 0ed23e59abe5..216db1d67d04 100644 --- a/Documentation/vm/transhuge.rst +++ b/Documentation/vm/transhuge.rst @@ -53,11 +53,6 @@ prevent the page from being split by anyone. of handling GUP on hugetlbfs will also work fine on transparent hugepage backed mappings. -In case you can't handle compound pages if they're returned by -follow_page, the FOLL_SPLIT bit can be specified as a parameter to -follow_page, so that it will split the hugepages before returning -them. - Graceful fallback ================= diff --git a/include/linux/mm.h b/include/linux/mm.h index 8ba434287387..3568836841f9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2780,7 +2780,6 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, #define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO * and return without waiting upon it */ #define FOLL_POPULATE 0x40 /* fault in page */ -#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ #define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ diff --git a/mm/gup.c b/mm/gup.c index e40579624f10..f3d45a8f18ae 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -435,18 +435,6 @@ static struct page *follow_page_pte(struct vm_area_struct *vma, } } - if (flags & FOLL_SPLIT && PageTransCompound(page)) { - get_page(page); - pte_unmap_unlock(ptep, ptl); - lock_page(page); - ret = split_huge_page(page); - unlock_page(page); - put_page(page); - if (ret) - return ERR_PTR(ret); - goto retry; - } - /* try_grab_page() does nothing unless FOLL_GET or FOLL_PIN is set. */ if (unlikely(!try_grab_page(page, flags))) { page = ERR_PTR(-ENOMEM); @@ -591,7 +579,7 @@ static struct page *follow_pmd_mask(struct vm_area_struct *vma, spin_unlock(ptl); return follow_page_pte(vma, address, pmd, flags, &ctx->pgmap); } - if (flags & (FOLL_SPLIT | FOLL_SPLIT_PMD)) { + if (flags & FOLL_SPLIT_PMD) { int ret; page = pmd_page(*pmd); if (is_huge_zero_page(page)) { @@ -600,19 +588,7 @@ static struct page *follow_pmd_mask(struct vm_area_struct *vma, split_huge_pmd(vma, pmd, address); if (pmd_trans_unstable(pmd)) ret = -EBUSY; - } else if (flags & FOLL_SPLIT) { - if (unlikely(!try_get_page(page))) { - spin_unlock(ptl); - return ERR_PTR(-ENOMEM); - } - spin_unlock(ptl); - lock_page(page); - ret = split_huge_page(page); - unlock_page(page); - put_page(page); - if (pmd_none(*pmd)) - return no_page_table(vma, flags); - } else { /* flags & FOLL_SPLIT_PMD */ + } else { spin_unlock(ptl); split_huge_pmd(vma, pmd, address); ret = pte_alloc(mm, pmd) ? -ENOMEM : 0;