Message ID | 20240409192301.907377-13-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 4FD76CD128A for <linux-mm@archiver.kernel.org>; Tue, 9 Apr 2024 19:26:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D578C6B00AA; Tue, 9 Apr 2024 15:26:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D07B66B00AB; Tue, 9 Apr 2024 15:26:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCF2D6B00AC; Tue, 9 Apr 2024 15:26:03 -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 973896B00AA for <linux-mm@kvack.org>; Tue, 9 Apr 2024 15:26:03 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D5F061A04F3 for <linux-mm@kvack.org>; Tue, 9 Apr 2024 19:26:02 +0000 (UTC) X-FDA: 81990973764.13.BBAE6A0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 2E4FD160017 for <linux-mm@kvack.org>; Tue, 9 Apr 2024 19:26:00 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="NJ/B/XP3"; spf=pass (imf08.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712690761; 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=oja6emUhi7xfrQgd9sof78Ea2rpQTjm332kNskpFfoE=; b=IY4DN5B++4gnOcOSuqOYDRCikjBUWmj5HlTMDTrabmdgERcZcggHzCdioij3eTGND3v6q6 qx/G6liBwolZfXi4WI3iEzW4SED1wgJdVoPdBGcGe/BVwM5ElKU/Sxp6oLKgjD11aC0CHj ltL5XHdJU5lsffZpBA05XAqnbCqOD2o= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712690761; a=rsa-sha256; cv=none; b=xwWcA+pPMzRFmZAacaxlFvZMfOkBm/XmpFvQrXbz7wGTm5k5idoQ4mzDY5wvXm1FJTf+Lz V4FwYYlrXIGid8pYdZbY8dyFGFb2tQCl4TcaWVfcM+F5Qd+iE2lFaonHZSjTLjmVeEhoMO xXF3TB4NLBuQHKKl4Xq3dehhmMNsGHo= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="NJ/B/XP3"; spf=pass (imf08.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712690760; 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=oja6emUhi7xfrQgd9sof78Ea2rpQTjm332kNskpFfoE=; b=NJ/B/XP3COVCpKvC1knjuut7NMF+3WV481uJFdHoqWl568jyCpFNgMtFRt5xvnbOqUI1I6 Wl/NjRpH2gdfJ12Dt5FO8RkqOsSWbzj7HezzQn+5e5J41UTXPIM1QnJ5WOyrbIhFtouUQ5 EDZF2H40S6x9hBj+Im6ZHNPfZHWoml0= 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-216-euyj5-iiOp6e2NecV838wQ-1; Tue, 09 Apr 2024 15:25:57 -0400 X-MC-Unique: euyj5-iiOp6e2NecV838wQ-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 262C9800198; Tue, 9 Apr 2024 19:25:56 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B6EB40B497D; Tue, 9 Apr 2024 19:25:43 +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 12/18] sh/mm/cache: use folio_mapped() in copy_from_user_page() Date: Tue, 9 Apr 2024 21:22:55 +0200 Message-ID: <20240409192301.907377-13-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-Queue-Id: 2E4FD160017 X-Rspam-User: X-Stat-Signature: b1pmaeytj13qggm8yd4odbnmgrgzgw73 X-Rspamd-Server: rspam03 X-HE-Tag: 1712690760-192218 X-HE-Meta: U2FsdGVkX1+tWOhmud7SUks4At07ui79s0kAlnnulLWMNTVgbPG0dH7gnz8J08FEM/O3A/OuK37r84rjH1omNBioovMK7a2VIqoxlPSr+9VRCI1WKuIWcUXwkIRGRaBTfgVz54VcX6onbFtFKvcvx9cZgG5V4oDU7wGvivsikxKPiwOY8TOCXCXCoiu+A9sRKZwtoh/WuhNcAVrVnHiMPTU1LlNKuDDosc8V6/r0EgXSGUqSsRZ184Fb7KOiR6+IWAZNrbP4eztbyDX617CvHDiWHyLyRWm21j0whyzdCeyKjkPM4PAfxQ8zzC27irNgUpiWlUr0nJ+DM6QAOe3+3JK/7UsLR00kjXHnkUICvUhbXqPr3EUkiAvMAiqcOn5atXYEZ9vFhQYkGvUSrARFI5Ln2LDvUkRqljFrpY+NOzdTxeUvqP2EaLfruNpQ/t+Va0twxhu/nIJNCjziC9trxH7j5Z0AJvrM1RQvbVTnh++VvWl8i7POEJ6ZMLAz/EdreNToBwsIdIkMjSZTzeugKE5xjHoDWneDVNhUzM9JiIRU7SA9QOzDTiiZ6ndEaq48r4RUTP2xEbXiskltHMDcerZeuLqzTsnbczkQEQBhFLNGtKhSqbEAfr52Zpvc+5Wp5rul12jV59eg6A0P2TAPcq6pWX3n5rMln0da7vIb0GlUtzC10Rf+eRHyBvV8VX2gXpPJQ+GEDvov4tViGQtYomt1+r0mHjWMzTWaEJA1nfmb0wLs+yAlqIlO8xmUsVxC8mSideQuy28dvSqaJvznuU5bNrpDom83jN5tyxryCIacglckDLzCG1qZkGSpbIsgIHBn52cIApBxSzlinNF1qRDYK23h1XsZXgu/t2sXcFRt5K5BADhEp4Bid0lNm/9nDidKXOB3wG2OaxwaHqEWU+gtdqwYT2JhIjsKryZeBw72R4+Kr9obPpqtq4l0V2LB1C9O021c+1Zokh3d+mT Z4ise+iN V/DiyzvfUaNTjsrDn76wIvyzFpg1NRv59c4NI3yoIADgMeHv/5pospHdCNHYc7Q5tU0Evf/K0kAlCoCDQ8UWNfA/fHBpUuIfB8kSPwUb/k+2eh+D6uf7HnvvQTjKaSYWQZp5NE2uuQECRQ+L6WAYDfNobBbSyUgydrwnSm8HpdpQ2zxB/gFqsWHEMNNQqtF++VUaWcFXOYyyu79N0pi2ex49d+Ms2aw/jz04Z 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/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index 9bcaa5619eab..d8be352e14d2 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c @@ -84,7 +84,7 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page, { struct folio *folio = page_folio(page); - if (boot_cpu_data.dcache.n_aliases && page_mapcount(page) && + if (boot_cpu_data.dcache.n_aliases && folio_mapped(folio) && test_bit(PG_dcache_clean, &folio->flags)) { void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); memcpy(dst, vfrom, len);
We want to limit the use of page_mapcount() to the places where it is absolutely necessary. We're already using folio_mapped in copy_user_highpage() and copy_to_user_page() for a similar purpose so ... let's also simply use it for copy_from_user_page(). There is no change for small folios. Likely we won't stumble over many large folios on sh in that code either way. Signed-off-by: David Hildenbrand <david@redhat.com> --- arch/sh/mm/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)