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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 2D429C433DF for ; Fri, 29 May 2020 02:59:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DF80A2075F for ; Fri, 29 May 2020 02:59:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="S30SMl1A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF80A2075F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 23112800D1; Thu, 28 May 2020 22:58:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48C06800CF; Thu, 28 May 2020 22:58:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C90C800CC; Thu, 28 May 2020 22:58:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 51D17800CC for ; Thu, 28 May 2020 22:58:31 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1750E181AEF0B for ; Fri, 29 May 2020 02:58:31 +0000 (UTC) X-FDA: 76868248422.20.cow16_101ee72912907 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id F32FA180C07AB for ; Fri, 29 May 2020 02:58:30 +0000 (UTC) X-HE-Tag: cow16_101ee72912907 X-Filterd-Recvd-Size: 2566 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Fri, 29 May 2020 02:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=NOeVvS/Xe8KyQK/jGHWOfgM4edh2SPt/XfnzQhgpf2k=; b=S30SMl1AinKd+Zgi5pubws24Mn s8xlXkZe1lDBI9STBHnSM5nLj0KNraX38WPIFuCf2pEvjIx4hYqSdy0lciAMVWGgxT2bob9z1iweE 5gPJn6lppPwxLIoGLEHqu+aGeevNAyQUmO8KHy8i3udRj0jI1OqgXRO28svI1munPlluxG1r+jiWo OKFZ5WprUfq1nRDnGtp6p96UjBRUbz9XeBtQOQgsRNDuowsbb3LgmmEiXpbKVCfHtGTKMmEA6mz5w fl9b04wNmiOM+EKdDgb/pP0mkwsCnhmZstTeorJT3e1KAhPAEuUYCoKrgN7rJqpdUfBGzvJpLianN ppKQEbiw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jeVE2-0008QC-QE; Fri, 29 May 2020 02:58:26 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand Subject: [PATCH v5 06/39] mm: Introduce offset_in_thp Date: Thu, 28 May 2020 19:57:51 -0700 Message-Id: <20200529025824.32296-7-willy@infradead.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200529025824.32296-1-willy@infradead.org> References: <20200529025824.32296-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: F32FA180C07AB X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable 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: From: "Matthew Wilcox (Oracle)" Mirroring offset_in_page(), this gives you the offset within this particular page, no matter what size page it is. It optimises down to offset_in_page() if CONFIG_TRANSPARENT_HUGEPAGE is not set. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- include/linux/mm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 088acbda722d..9a55dce6a535 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1577,6 +1577,7 @@ static inline void clear_page_pfmemalloc(struct pag= e *page) extern void pagefault_out_of_memory(void); =20 #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) +#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1= )) =20 /* * Flags passed to show_mem() and show_free_areas() to suppress output i= n --=20 2.26.2