From patchwork Fri Jul 28 16:13:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yin Fengwei X-Patchwork-Id: 13332105 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 770ABC0015E for ; Fri, 28 Jul 2023 16:15:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1788C8D0005; Fri, 28 Jul 2023 12:15:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1299E8D0001; Fri, 28 Jul 2023 12:15:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F33468D0005; Fri, 28 Jul 2023 12:15:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E1D978D0001 for ; Fri, 28 Jul 2023 12:15:28 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B11F712071D for ; Fri, 28 Jul 2023 16:15:28 +0000 (UTC) X-FDA: 81061520736.27.1BC575A Received: from mgamail.intel.com (unknown [192.55.52.93]) by imf04.hostedemail.com (Postfix) with ESMTP id B962840007 for ; Fri, 28 Jul 2023 16:15:26 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=iphbs7IB; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf04.hostedemail.com: domain of fengwei.yin@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=fengwei.yin@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690560927; a=rsa-sha256; cv=none; b=bb6GcXQdbwXlPzUlZDnuLnRpSkFghOnO8Nc/k/+4rCmMAC6GwpnHBNkd7B4+eOVzA0KxXj j7fLVm8mzE8ugBjmJlx8QBP2WuORigz2IootRzIuZ02rcOrTakSYsGB+dPPNOCSXxIlpEr /qB/HPV1xHMr7zsE72Yyq/Dj1PDkhwA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=iphbs7IB; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf04.hostedemail.com: domain of fengwei.yin@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=fengwei.yin@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690560927; 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:references:dkim-signature; bh=K/ZTpE16PPreO9NApK1k/45KIWgDVcmjT2thuaeDrtc=; b=e4X36lC50KooZSu/V1uPoQr9QRx9amS6cRLbZfydlFzvAYrVyytNesMNW/yZfVuntLG/Yq UlRfOkv/g9viCtuwyxlzzEzMBVQ92CXvAXIVnQbOVHHDFu1aPflRdeT4h3U5tjSEglb9Pz 1pDzROwFgUAIFRLzPJ8uBPXwF5fwFkU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690560926; x=1722096926; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=AKGrusEfmjGs5zEr3mhPbr/2FvOKxjtxXpulNBDQ1G0=; b=iphbs7IB+QA5zhGhewgc5JLYALmY6+XSPy8cZxJYcuvNHTjX2VXokI4N S+KqIDS7EylFb+TFHzlUXK3wEZVtQRjFiiRPkb4tFwn7MZqzKYlpq2mpN 9ZwXIuyE6v8Fy1qb/GqnR+ZpXiFrOH9ikoyBJ6Ib1cHrC7tW1AZ1davvY HeRWSi7X7zLhvhOt4Vpes5V/z7pB+xHEaAu8/COyfA6jQ1CxwyDKrtcrp 1DOsaM8VgrE0KtQOvMVS01kP4QRdja0nWVvdyBFtA7fgbTQIPRq2IM8kK nicKUvrVHTI4GjTLRVEU9dn7gaWRTTV5yv2Cbl1vdNR8g3f5zJ6d3cokD A==; X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="366092839" X-IronPort-AV: E=Sophos;i="6.01,238,1684825200"; d="scan'208";a="366092839" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2023 09:15:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="721313805" X-IronPort-AV: E=Sophos;i="6.01,238,1684825200"; d="scan'208";a="721313805" Received: from fyin-dev.sh.intel.com ([10.239.159.32]) by orsmga007.jf.intel.com with ESMTP; 28 Jul 2023 09:15:21 -0700 From: Yin Fengwei To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, akpm@linux-foundation.org, willy@infradead.org, vishal.moola@gmail.com, wangkefeng.wang@huawei.com, minchan@kernel.org, yuzhao@google.com, david@redhat.com, ryan.roberts@arm.com, shy828301@gmail.com Cc: fengwei.yin@intel.com Subject: [PATCH 0/2] don't use mapcount() to check large folio sharing Date: Sat, 29 Jul 2023 00:13:54 +0800 Message-Id: <20230728161356.1784568-1-fengwei.yin@intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B962840007 X-Stat-Signature: aqumx4pdrp8gqn8p59j9gr7n1r6qd34m X-HE-Tag: 1690560926-635004 X-HE-Meta: U2FsdGVkX18wezVcLz/f/O7V0fEBR9OrT0zYfTjW1pa5cKQ/YVkWrbYPc9lQgElNQEAxsHo3u9VoSTVZUrud9PDxwMvAYUSo+OQINNv/192viUDnL1MZ6DX6NGkP34i/H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DsUMb1D51PtsP9RHOY20lDJgTjMH/4Q== 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: In madvise_cold_or_pageout_pte_range() and madvise_free_pte_range(), folio_mapcount() is used to check whether the folio is shared. But it's not correct as folio_mapcount() returns total mapcount of large folio. Use folio_estimated_sharers() here as the estimated number is enough. Yin Fengwei (2): madvise: don't use mapcount() against large folio for sharing check madvise: don't use mapcount() against large folio for sharing check mm/huge_memory.c | 2 +- mm/madvise.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) Reviewed-By: Ryan Roberts