Message ID | 20240409192301.907377-12-david@redhat.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 4E29BCD128A for <linux-mm@archiver.kernel.org>; Tue, 9 Apr 2024 19:25:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE29E6B0082; Tue, 9 Apr 2024 15:25:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C92896B00A8; Tue, 9 Apr 2024 15:25:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B32DB6B00A9; Tue, 9 Apr 2024 15:25:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8ED5F6B0082 for <linux-mm@kvack.org>; Tue, 9 Apr 2024 15:25:50 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 55EF4C0522 for <linux-mm@kvack.org>; Tue, 9 Apr 2024 19:25:50 +0000 (UTC) X-FDA: 81990973260.19.8C9EE90 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id A03BB40009 for <linux-mm@kvack.org>; Tue, 9 Apr 2024 19:25:48 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eGRYGrD0; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712690748; 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=IN3zVkAYwXXWogoRwDYvxGTLC4K4Gwg+xwqZ7vjK29g=; b=hfUo/BaV0MBNLAVfvUJGP7EVkifS5NFC4gl0VomQI3GIv9cylyiNJh776N5kulq5VJ29Dm 31fw5LeQNRGQSFn2fQZvW5DsD70KjngsJfBaJQHxuLsUlHrMaMFR+4PHz8IVU98Cw+hN3Q OFacMYhTGA1bZnGcZSw+FwpWhlinNJI= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eGRYGrD0; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712690748; a=rsa-sha256; cv=none; b=JEP/Cem0jNG6eMCJ0jdmKpQkblTtrdg+U7r8+5APz4nFVcxSgEEJA+PxkSLZ+LdoNUlmdO iCbUx2I/GNLqqKDG7KLADrdzYdhKokwx4fP3GkjjgbvVkamRUTsRCKUqWvqXTR8T2E8o5e W0rjQKR5h4ENQgy97an48jdTFK7mTS8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712690748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IN3zVkAYwXXWogoRwDYvxGTLC4K4Gwg+xwqZ7vjK29g=; b=eGRYGrD0mix9TbzfmvMEQs0Eat17QablvqmefU5u9sgpWt9VKY+8+d9mVVPUA0qVNvreWw nTQKBKk+SKnW6Xmm8wcD4VguhxUj+RBqOV73yfQBLtBUtRG4JjMfrVP515yRiRP+Tr+W/M 2fq0k2G6xJZYUyriIrQLc1fKwVP91IY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-512-p7aYNzngOOiEyTZuHcjUMg-1; Tue, 09 Apr 2024 15:25:44 -0400 X-MC-Unique: p7aYNzngOOiEyTZuHcjUMg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A0997830E7B; Tue, 9 Apr 2024 19:25:43 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD0CF419FA38; Tue, 9 Apr 2024 19:25:33 +0000 (UTC) From: David Hildenbrand <david@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, cgroups@vger.kernel.org, linux-sh@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, David Hildenbrand <david@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Peter Xu <peterx@redhat.com>, Ryan Roberts <ryan.roberts@arm.com>, Yin Fengwei <fengwei.yin@intel.com>, Yang Shi <shy828301@gmail.com>, Zi Yan <ziy@nvidia.com>, Jonathan Corbet <corbet@lwn.net>, Hugh Dickins <hughd@google.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, Rich Felker <dalias@libc.org>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>, Chris Zankel <chris@zankel.net>, Max Filippov <jcmvbkbc@gmail.com>, Muchun Song <muchun.song@linux.dev>, Miaohe Lin <linmiaohe@huawei.com>, Naoya Horiguchi <naoya.horiguchi@nec.com>, Richard Chang <richardycc@google.com> Subject: [PATCH v1 11/18] mm/migrate: use folio_likely_mapped_shared() in add_page_for_migration() Date: Tue, 9 Apr 2024 21:22:54 +0200 Message-ID: <20240409192301.907377-12-david@redhat.com> In-Reply-To: <20240409192301.907377-1-david@redhat.com> References: <20240409192301.907377-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A03BB40009 X-Stat-Signature: rais99hqmfqnnqu1ur63em9amswg6gct X-Rspam-User: X-HE-Tag: 1712690748-535841 X-HE-Meta: U2FsdGVkX1+U2vDBxQhgCyctI7O6PbJn2wuhkG/JDH0yzgj66lhEDQ6sMQi0S50pD8NB6TM3Hc2miwzCiw5A4oGHZaouQYnGIfxVzQS9MNRlhdFhztW64b7uqCT2VqReStjrZNUrRJ6c7cC8j7ds6C0jqxjYDLJDF1vvm8zz5Fk+UC2iDn9Knr02daCn4ufHD1YAWXNI4+nnCwTeFXh3h0jjTLp6v13TvLayKKQZOlfGX2nGmqf8ECRFWf8KwWbWGJ/11CLSY4lPw8k7kET7vE53zcPqj4Rk4GI/kzB+q2CwQnDYUC1T3pi4M/ppmrEOYWDun7usG8PUVlsKIfLxRfo9EsIVqBcZOf5kicyvNuvj1Yporng5uveYuzVp5z+BkuOuoI43XiliPm1cHtYDhRTu9PJOhYfh8S83h+rKCAjput4wKEfMdWL49MTigLnTCNSWHnnFwtBElhmZ7FDucNwkOFsiYXL/bpmSfUpkTBAAqkJk46jEFyy9ok/kGFNtEI8QwwlNIBi/dQ6+fnvT9ui4Ws6Ibi0fPdfKB8qyQOhVAya8SaymJUpwq4OyypZ8aJQE2nX1CaB8J0l6SrH4LXGPE3qtRwcIfy4cKKDutQw0lV37/N7uW9gKzQ90PZckgnni+TtOPfUtiWs+jyTikGQ0sUiWNIAqg9WQhNu9lArPXcsp/hgNR72I+iEcJQDuFF7s12QnoFyvPiDS/xfYZ85pNqedOd9tcx3h56u8FjB75PapOQFW3sG5aVXmlU3WY/+y3xtdAUOxfx9IUZWrPoQeYpCNQd06Ak5eUNDyjrklTUPGc5Uom1NA0B+MtEJlY0RYf/jh9mSmpSHpY5TVT4sj5gqrkqjdVCfDf1JZgH5OUVEQDwMDxz9HbiUpysF75uLCiyuZgh+c6cFR6GJXEWOrfeQnNUrH+hJ+NxMwqvWs7nQH8UcpYydf3SJ/tge+vjGAMVzfrVUWQ/MVun1 xPv5N9We zzwoqH2wNBkGP4OHo4eWSwvhfrsXkSJVfCdpv2+xdKT2iuAxM2go2Sz19RjgOQV85xXGx/yrduBl1/kLJJLr1SOARAqIwOd/H3xkz05oSWD2TomRdUwvk3dT3lJh651/XvSmzt+Fi1Ic5h+107u73wAMiLF80uRNmi+7tC2jR59zQLUyU1VW7bVgGGFSESWRzWcpwka8ePzbvuAiD3UCpk33sc7Dn2u1ZVJ2E 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm: mapcount for large folios + page_mapcount() cleanups
|
expand
|
diff --git a/mm/migrate.c b/mm/migrate.c index 285072bca29c..d87ce32645d4 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2140,7 +2140,7 @@ static int add_page_for_migration(struct mm_struct *mm, const void __user *p, goto out_putfolio; err = -EACCES; - if (page_mapcount(page) > 1 && !migrate_all) + if (folio_likely_mapped_shared(folio) && !migrate_all) goto out_putfolio; err = -EBUSY;
We want to limit the use of page_mapcount() to the places where it is absolutely necessary. In add_page_for_migration(), we actually want to check if the folio is mapped shared, to reject such folios. So let's use folio_likely_mapped_shared() instead. For small folios, fully mapped THP, and hugetlb folios, there is no change. For partially mapped, shared THP, we should now do a better job at rejecting such folios. Signed-off-by: David Hildenbrand <david@redhat.com> --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)