From patchwork Tue Jan 24 01:22:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13113242 Return-Path: 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 53910C54EB4 for ; Tue, 24 Jan 2023 01:22:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B671B6B0072; Mon, 23 Jan 2023 20:22:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AEFA86B0074; Mon, 23 Jan 2023 20:22:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 969266B0075; Mon, 23 Jan 2023 20:22:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 846DC6B0072 for ; Mon, 23 Jan 2023 20:22:19 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 56184AAEC6 for ; Tue, 24 Jan 2023 01:22:19 +0000 (UTC) X-FDA: 80387941998.13.12F23E1 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf09.hostedemail.com (Postfix) with ESMTP id 8C260140003 for ; Tue, 24 Jan 2023 01:22:16 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Szcl6AW6; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674523336; a=rsa-sha256; cv=none; b=M4rAvw4g/GiPnXZ4CBJFUgsgpAuE/834miuHVfVWJ/sSs6MQyn/8xrqCPhwJN9OsuXc6vf rcHsGPq/9bsLxPwlFZIVrCbjjZjyTzFvRe5/IhlnZuOZbuOn6A7P4hsKmZvhBY3h/ue+xP FyseqqUi3vKW2QNO2l4clY1utt9WolA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Szcl6AW6; spf=pass (imf09.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674523336; 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=g4yYO75/EwQZJYH40lk5sQ9ghbUufbuHyMXdhMR3QCQ=; b=VL6sPixwCJCR8y+5e3Ymgv47/sFiuw6n0Yn8joOy3zM+8kmxAAPn7dWw6uQwTouT0pAVUl pPjDni2+h3R/3x50M9340Mi2QZB0NO6FVIju+R2GbCEn81MgCxDQ+hvQMveX0t5Aj+44k/ l6EMmgngiD9OGlVGh46i0pUxuMy5/KI= Received: by mail-pf1-f177.google.com with SMTP id w2so10175840pfc.11 for ; Mon, 23 Jan 2023 17:22:16 -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=g4yYO75/EwQZJYH40lk5sQ9ghbUufbuHyMXdhMR3QCQ=; b=Szcl6AW6otWDqobuZJtGwtF7glIsetJ71TVMtKHGZGZCFaMHizeHwXV0GBU46ckXD8 AN03PI7hEuIMhWD4c1RA5sz5Wtm0fMxgKre5TWnzTXjzlDSiM160wux/hWv/nzN1CHUP R4EnE3slgjF0R/6ei4HCL+ijvHGjHIqm07siw61r2CmMthT9q78b3av8tIsayCUVJdIX Wn9VAjNm+k2HfFN9Obbc/ey33I9I4xxPmyFz5bNRWXizKCXMsohhMOA5Zi4XFNzY/717 gPoldZwss7g2sYCp+RKJRKbjpWnwlpDf34GjSqD+FxKsv2ctHsqvnkUUIpjvVyeOlSps j9Vg== 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=g4yYO75/EwQZJYH40lk5sQ9ghbUufbuHyMXdhMR3QCQ=; b=dZPMqMIUa3X710Q0AspR9LDKZUe57r9Y4DNOH8o7spPrYAdouqS7rNDoXBMQIFi1Wp aAO2jxroPmmeUD/m2Twdp8NruJa7XuOdNGpEWeJDvmimcXkaJQwh0ycBllVgsSRU8GjV o4IB4+VvcopG4D0q/377GS+yZ0wcd41T9jYPGftZVaJad0evqIZt5b32BFwFfKE3NP2n iTNjryp8GTZV/0bCdEk1zBrwvU1jnCdLdFgm26yyMIBY6pgCtalpJcfOP+VbX2Q2392S ia9cVU40gkzrxTqDXeMSAGejMQtDN7mkUwLBq2EMIK3l3zWsiP7kQN9iPBPnnVNtcqbX Fn7g== X-Gm-Message-State: AFqh2koc6Jxu74wUxWmOqz/N1qzT3m6rBa9e4+AUiWRi6o1CVlVvPyNO NtI7vTOapmTTgE+fsaFBbS88imDCBRE= X-Google-Smtp-Source: AMrXdXvHdIldO2gQfEASMMQES9OCx71pQy0FZT6R+4tjFAeePnD43v8oa4X1PBOCFGYQ88pQyytS3w== X-Received: by 2002:a62:e911:0:b0:578:ac9f:79a9 with SMTP id j17-20020a62e911000000b00578ac9f79a9mr23724189pfh.15.1674523335209; Mon, 23 Jan 2023 17:22:15 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::4e4b]) by smtp.googlemail.com with ESMTPSA id 68-20020a620547000000b005825b8e0540sm213335pff.204.2023.01.23.17.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 17:22:14 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH mm-unstable v2 1/6] mm: Add folio_estimated_mapcount() Date: Mon, 23 Jan 2023 17:22:05 -0800 Message-Id: <20230124012210.13963-2-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230124012210.13963-1-vishal.moola@gmail.com> References: <20230124012210.13963-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 8C260140003 X-Rspamd-Server: rspam01 X-Stat-Signature: ftzxbmpsp6kta3dkugmjtcmojrfogfbd X-HE-Tag: 1674523336-207564 X-HE-Meta: U2FsdGVkX19L289L2YYAvcESxCy8AxLXeeASi2SqkwZeDGgVyZtN79zY2mODtaG6GHFXBkvYNbmup1acJD2lk5vd2OHWNkz2DmN572dt9/4Kn7BasTMsLEdwac2us9XVQsyJZde1ezYAvugMN/71k5BFLlk3RvzW+z6rw4CMpocuGJvoh3Nl4Gr2shpa9P0fUYs1WLHyWOxaILQWv/HRbmIbQ1DbnFZj98y+ig1djgXR4FGOEQf62NI5+GgfFHE6OqL5iWAMP3/hEKQiqOD0/lHO7/1ZP+acvUbR5BMWWBTP8cYby6oID0InMge2OcNASzzs0I3nrql6gDjlKwC3poccCE0vfVYPj1CceTVaJVOh/o9AFvn3FmBbHiwiQ2UyHODmgRU23aE8UVith6DHDnAOUt6xNmdSemCIK+u7rseGKKQLYhBQYNivGAHWi5pZAoVIY3CPhRFSxiXKd4mwB0YS/cD54MRRslOrlKp21pk9LZPTM/o2YWJmTkebTIUN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amicity=0.000662, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: folio_estimated_mapcount() takes in a folio and calls page_mapcount() on the first page of that folio. This is necessary for folio conversions where we only care about either the entire_mapcount of a large folio, or the mapcount of a not large folio. This is in contrast to folio_mapcount() which calculates the total number of the times a folio and its subpages are mapped. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index c9db257f09b3..543c360f7ecc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -875,6 +875,11 @@ static inline int page_mapcount(struct page *page) return mapcount; } +static inline int folio_estimated_mapcount(struct folio *folio) +{ + return page_mapcount(folio_page(folio, 0)); +} + int folio_total_mapcount(struct folio *folio); /**