Message ID | 20230125234134.227244-2-vishal.moola@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAFAAC27C76 for <linux-mm@archiver.kernel.org>; Wed, 25 Jan 2023 23:41:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D6706B0073; Wed, 25 Jan 2023 18:41:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 75F576B0075; Wed, 25 Jan 2023 18:41:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58AE16B0078; Wed, 25 Jan 2023 18:41:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4AD886B0073 for <linux-mm@kvack.org>; Wed, 25 Jan 2023 18:41:49 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0C26AA0E4D for <linux-mm@kvack.org>; Wed, 25 Jan 2023 23:41:49 +0000 (UTC) X-FDA: 80394946338.13.A85F9DA Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf05.hostedemail.com (Postfix) with ESMTP id 3947110000A for <linux-mm@kvack.org>; Wed, 25 Jan 2023 23:41:47 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mIXSbS3z; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674690107; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BGNwUbDjmHky71GpbBmE9Nh0iBILc0cb1v5YBQZD5HQ=; b=sET4MBvp3D4pgmO4Jzv/mUzRk2hBj4Dvtfw/ImuOWP4xjmK3260DcyjvvjZ2qsAINXacnE 1D1A6i0+Ti5HWaBqJJvv/t/iTGVksgvUJFDMn/YdLIFGlr1+561eTcgAQ4/N2DELTsK8hk yg4NwVvaz5ECaElsynlAC4D4xksfAQs= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mIXSbS3z; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674690107; a=rsa-sha256; cv=none; b=aBVwPg6Iui+SAlJEg93EckrKVcZu1BoGgdmNMqEXrgewisQVqlYSsk4hXPhWOEBIWHSyi8 XnZ0mkl5wsRl0UVbpP6Nyf4u1u9jWJue6qDavh+ymoyZRsmB0wwhuqr2p8DG2bNhMWv8Vm TndQu3Dc02uajXfZOUTlmWgPCth5tbs= Received: by mail-pl1-f181.google.com with SMTP id c6so446657pls.4 for <linux-mm@kvack.org>; Wed, 25 Jan 2023 15:41:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BGNwUbDjmHky71GpbBmE9Nh0iBILc0cb1v5YBQZD5HQ=; b=mIXSbS3zx/wNtBmDxZy9pZVvSQJv/mHw4CtjWD65+3W9Nc24sZUEDDrNS8oORXHJiB CGLmGyovSMwnhhTJMVQUd2L8GZWQRYAR8SllfoLNKEh7wrEFC3j3GTPcpO6eGTt7IB6K lBtFoVj4NrI54l4nxgO5tQt5fd01MB+QIlXVuAOr/ab4O+2GR41LajuWCD6FMFuOkAbT foNteELlF+BDx6tehXHJkvTXF29r//7Ulc+DmZlFdhCsp3uvvGWYSsETbBZM2P3pBhTp ISJu5TQzkh/8DkQKSyiad0S01AG/Ia9PJmFtvYNhAgSLLO6dL8TA1pu24hsqMP5gFGpv Dniw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BGNwUbDjmHky71GpbBmE9Nh0iBILc0cb1v5YBQZD5HQ=; b=ZOSH47PbEDcgbGa/X4+yHvhi7vCYxlHsTzP9vZ0LaoySvs7+Vhv0u/cfJ5v5uqqLAY zEBMKJBEgPAsMtjBoXOZGXMJRx37/TdHMRluqpPmRBow3sLKw0/g+NHC7fHDcmeMMYnt Lv5Jt7+j6JWi9Wc5YkLS47AcNiQWdyWzgk4xCYqW6BVNEPJXUaU9BFi+VYTkpZTL4RoE 3CEItlNEIWaqTYtPFBA3ijiA9MhRQaU0xPblXWn6s11YqZd9lN0a7Ek/wlGjF39iyi3z xItGCQW6AnHOs/zpxfNt+4ip5Okln2k2NK2C1exqEexfOFJ6w59iR0j+8Iln27rqaQGd n0Kg== X-Gm-Message-State: AFqh2krYit1zapbEkskekHn3p3a7ShZoZg+LYdJFvLbeFIJ/hp6+ZDuX KlljVoq1oy7kD8O/hTfP0AqPAbbCvLIvNw== X-Google-Smtp-Source: AMrXdXv1TwX5bErJjQ9rOnQpq3s7ctcdlqui9fwxZ8JXfbnCm/ilrQAv8fF/p6GLVjSDREEOIxnLsQ== X-Received: by 2002:a17:90b:1e4b:b0:229:ff05:691a with SMTP id pi11-20020a17090b1e4b00b00229ff05691amr23275110pjb.16.1674690105896; Wed, 25 Jan 2023 15:41:45 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::4e4b]) by smtp.googlemail.com with ESMTPSA id e8-20020a17090a630800b00219752c8ea5sm2226806pjj.37.2023.01.25.15.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 15:41:45 -0800 (PST) From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com> To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" <vishal.moola@gmail.com> Subject: [PATCH mm-unstable v3 1/6] mm: Add folio_estimated_mapcount() Date: Wed, 25 Jan 2023 15:41:29 -0800 Message-Id: <20230125234134.227244-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230125234134.227244-1-vishal.moola@gmail.com> References: <20230125234134.227244-1-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3947110000A X-Stat-Signature: n8yhfsu349z7jo3ewuws6n5u3m7195wm X-HE-Tag: 1674690106-884270 X-HE-Meta: U2FsdGVkX1+OQps2fGzZVscLW1KR84L/y+OKCoU8SWi+tSfxCBy0WiSXM11597ZeKK6T23ID/qKscR/5NF/Pj6Wqi8VZjudKV7dmS+AgjXR7Aa2KLy0AogZbjjYVzBihXJehvb5CK4GbrClGQT+hcqO66IvMlOlEm1i2ZmJwQ4u6gV5tYAJrDsGxwecv0046hdwIK5DX4gPPqqLh4Ji5QJYVX7qhUjiWrSd/LADF5ib4mm2PYF80T6Y/9De1mDlIQ/URItdlSizKjDSUOOkIdD7C/B4/bF/9RxLS8xznbYmzCXOjJCTUZ6K5GBtXThD7WCRI20SBV8LhRmbhAT/pu8XLvDbUtfuXav9mfq6e/CON9mE1rdJdfu/XRgOgR4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W4Y1vFF+3nFDwnH55mxbDvtKEzGOgYU7k8VQU6CkdsEH7L/EiGtP4oeTDsV6FlrcjjIst0yEotcjSgSQ4xrJOtF3kxhGU2gsO6XvFhSkusZBsBYSVycQVXAK3b/LWhS2+9jndtQQEMZ7BmkA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000018, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
Convert various mempolicy.c functions to use folios
|
expand
|
diff --git a/include/linux/mm.h b/include/linux/mm.h index c9db257f09b3..fdd5b77ac209 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1817,6 +1817,23 @@ static inline size_t folio_size(struct folio *folio) return PAGE_SIZE << folio_order(folio); } +/** + * folio_estimated_mapcount - Estimate a folio's per-page mapcount. + * @folio: The folio. + * + * folio_estimated_mapcount() aims to serve as a function to efficiently + * estimate the number of times each page in a folio is mapped. + * This may not be accurate for large folios. If you want exact mapcounts, + * look at page_mapcount() or folio_total_mapcount(). + * + * Return: The precise mapcount of the first subpage, meant to estimate + * the precise mapcount of any subpage. + */ +static inline int folio_estimated_mapcount(struct folio *folio) +{ + return page_mapcount(folio_page(folio, 0)); +} + #ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE static inline int arch_make_page_accessible(struct page *page) {
folio_estimated_mapcount() takes in a folio and returns the precise number of times the first subpage of the folio is mapped. This function aims to provide an estimate for the mapcount of a subpage within a folio. This is necessary for folio conversions where we care about the mapcount of a subpage, but not necessarily the whole folio. This is in contrast to folio_mapcount() which calculates the total number of the times a folio and all its subpages are mapped. Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> --- include/linux/mm.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)