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.8 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 4AA01C433E0 for ; Mon, 29 Jun 2020 15:20:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0DCEE246D2 for ; Mon, 29 Jun 2020 15:20:25 +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="oxJiuoz3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DCEE246D2 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 E31F96B0072; Mon, 29 Jun 2020 11:20:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE3246B0073; Mon, 29 Jun 2020 11:20:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF6E16B0074; Mon, 29 Jun 2020 11:20:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id B5AA96B0072 for ; Mon, 29 Jun 2020 11:20:18 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 41E4E8245571 for ; Mon, 29 Jun 2020 15:20:18 +0000 (UTC) X-FDA: 76982610516.16.crow51_5f03cc626e70 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 063BE100E6933 for ; Mon, 29 Jun 2020 15:20:16 +0000 (UTC) X-HE-Tag: crow51_5f03cc626e70 X-Filterd-Recvd-Size: 2517 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Mon, 29 Jun 2020 15:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=mgRyF4t388omSRz/7T6tzwex9Fbu7NAPN3gXzzR0XVQ=; b=oxJiuoz35GYzywp31X41L001WB XGBVvf59YdLLonY2HTqhqUXYet+Y+uVWlnfhwnStjzWSwwlIdV0avNvkOG0mhwPKmabt8j+BEPDUR HWsKCt60iTl+lWvm3MxA4o3JLi5n+fSFT+gkOKjWGpS75QpGFoS+Lu7bjsigc/xV5bqg/SGMiDvIi PZxbAulXlm3OlmH0XgII8VxBYlEV5rcxROaXaX8SST9U3W3EggFSgZh4jQyjZRRZS0MAOAx1x/yxD msPsl6JsEJU5rYsOb/uTYIHLERy82eYSucK8D/RDj4Q0QUahKQZqv3lwithuD4Fhi7A5SRWTDyV23 RrcJJxYA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpvZq-0004Cj-B4; Mon, 29 Jun 2020 15:20:10 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton Cc: "Matthew Wilcox (Oracle)" , David Hildenbrand Subject: [PATCH 7/7] mm: Introduce offset_in_thp Date: Mon, 29 Jun 2020 16:19:59 +0100 Message-Id: <20200629151959.15779-8-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200629151959.15779-1-willy@infradead.org> References: <20200629151959.15779-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 063BE100E6933 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: 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 6c29b663135f..3fc7e8121216 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1583,6 +1583,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.27.0