Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4339766pxj; Tue, 8 Jun 2021 11:55:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEHhDyGseF2/OPe2+sZ3e3EAOBokwa2bWfJGUsrKGOdmlGl7dKWydanRJV04x9Ej1X7jYV X-Received: by 2002:a17:906:bb0e:: with SMTP id jz14mr24640086ejb.285.1623178500810; Tue, 08 Jun 2021 11:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623178500; cv=none; d=google.com; s=arc-20160816; b=Gu56A1IHt3WOQ3m2zIL/Bila8KXx4BzJpamKLkymn4oT/D9IsP0l+NgsLIwLpTEDaT aaGyqSG8uPoxS6WcLc7smP/+LoDn0016Jls4XGTbC7nNXhefAaTpcUSOXm8GsUsHDe3X SfI/E1O8D3dJ6WaY3VdCHZt/0dqN4PsoJPKXvFDRf0tbes+irlZorKWNlLxkTMus8HVx GVWv1pWP6+PBjn+Jr41GTg6fAtN2URxxsWeKfys2IQdkpv/PH8XbyroxCiNSyFJhDdyt BInhMn42uxVgSiDCm/grl+S6WT6PRxm/JcWht+/W3EajUmJKLVsRmByCkQLReJ8JZiOS wf7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5UrkwIZFu1LtG7Vmmh1gTxFurLdjpM8qdAai2ChEAag=; b=LAUdf83Rg7fdYeVbj7nNvIL7uy9X0OpNDXlOP47nRdLf2bEo/9etZ7owx82Z0Pf+AI 2zlahW5N09Uy2kvVWIUp4yKB9XWd72EU6WLrPljOHmO3pkwq526/u1lKJq2Pb3JvjLbw jamNgPeB56AjnEOFL7qK3Znru4GBhogaJxqygmaaOKYDFhp6WQnxV0ucxCe3fTnJn7xM tihw/cQL8SvWrh9V5Jz5l04PrEgyDYfGu9KIlJrmgDnswtn8Y/3C5WYSnLsnkpL4aoyh yn6KnxmEwFWfCbjNNI6JprqCtKdsafNaFHXyZn6wz0bXXKrhLrQyK/zlD5b6n5O0+qBz 7mfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uJ5V0M49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r18si371953edd.158.2021.06.08.11.54.37; Tue, 08 Jun 2021 11:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uJ5V0M49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235700AbhFHSxc (ORCPT + 99 others); Tue, 8 Jun 2021 14:53:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:44434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235615AbhFHSrI (ORCPT ); Tue, 8 Jun 2021 14:47:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4177761406; Tue, 8 Jun 2021 18:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177479; bh=BtUMkyt4Ii44XjnnzVn2lkfQX5Yt3RcOKD83rvHMfwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uJ5V0M499dVw/fEoAIYOEqUD9x2ZJblacjDMKxS0f5CXm9Sh2XjpLmuwZCHf+fDpv 9uMwtUS3fJT8slXLBim87uDPX8fJNSydMqUnlTt5Hr5Gw3skCAHakK+/oS2mCvUnQS sZw8v8xrcw6M6tf6EYrD3RDMaO8LFOXbxa1nFCNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , "Matthew Wilcox (Oracle)" , Andrew Morton , William Kucharski , Zi Yan , David Hildenbrand , Mike Kravetz , "Kirill A. Shutemov" , Linus Torvalds Subject: [PATCH 5.4 65/78] mm: add thp_order Date: Tue, 8 Jun 2021 20:27:34 +0200 Message-Id: <20210608175937.462236794@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175935.254388043@linuxfoundation.org> References: <20210608175935.254388043@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Matthew Wilcox (Oracle)" commit 6ffbb45826f5d9ae09aa60cd88594b7816c96190 upstream This function returns the order of a transparent huge page. It compiles to 0 if CONFIG_TRANSPARENT_HUGEPAGE is disabled. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton Reviewed-by: William Kucharski Reviewed-by: Zi Yan Cc: David Hildenbrand Cc: Mike Kravetz Cc: "Kirill A. Shutemov" Link: http://lkml.kernel.org/r/20200629151959.15779-4-willy@infradead.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- include/linux/huge_mm.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -231,6 +231,19 @@ static inline spinlock_t *pud_trans_huge else return NULL; } + +/** + * thp_order - Order of a transparent huge page. + * @page: Head page of a transparent huge page. + */ +static inline unsigned int thp_order(struct page *page) +{ + VM_BUG_ON_PGFLAGS(PageTail(page), page); + if (PageHead(page)) + return HPAGE_PMD_ORDER; + return 0; +} + static inline int hpage_nr_pages(struct page *page) { if (unlikely(PageTransHuge(page))) @@ -290,6 +303,12 @@ static inline struct list_head *page_def #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; }) #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; }) +static inline unsigned int thp_order(struct page *page) +{ + VM_BUG_ON_PGFLAGS(PageTail(page), page); + return 0; +} + #define hpage_nr_pages(x) 1 static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)