From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 190CBC3B189 for ; Wed, 12 Feb 2020 04:19:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D2B48215A4 for ; Wed, 12 Feb 2020 04:19:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dkvEEjgL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2B48215A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D07036B03A2; Tue, 11 Feb 2020 23:18:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A86F56B039F; Tue, 11 Feb 2020 23:18:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61AE86B03A9; Tue, 11 Feb 2020 23:18:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 668806B03A2 for ; Tue, 11 Feb 2020 23:18:48 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 04B67180AD807 for ; Wed, 12 Feb 2020 04:18:48 +0000 (UTC) X-FDA: 76480169136.03.price76_129796f8eab3d X-HE-Tag: price76_129796f8eab3d X-Filterd-Recvd-Size: 2765 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 12 Feb 2020 04:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=NvMfSbwCSPQiuZsVqZ+gREFLXJWQ8lHxQALsTybal28=; b=dkvEEjgLlJHt5AUjH/hWPpXsBM lvuxoe/UOq8JMvoe4+4d2BIvo6eOU/p/MgXsXq4YB7gYbXgFFo0Mu5apYDAh2dsrW5vd4BgV6XZJE YAFMVpJO0SUtPSCPR1Ykw3uoryiy98Elgl14DBpGG6bYlMS6ug+xx/vw5p4m8wSxkDae6nxACaB50 JyFVlMdaM6MyG1iN+HegUPoASXD8Q2wsxrpX0158WABia1lrxdNI7Zpo0FAGwy6cRUJgzoU5k4yox Br/r/CtwEdK8t6TEE56VC4g60V3GKDvaqMOHo24Eom5/5TB54IhcZiwEx+OLv0zJDjDwU+OoEiizA j5WW+MTw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j1jU7-0006nq-13; Wed, 12 Feb 2020 04:18:47 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH v2 13/25] fs: Add zero_user_large Date: Tue, 11 Feb 2020 20:18:33 -0800 Message-Id: <20200212041845.25879-14-willy@infradead.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200212041845.25879-1-willy@infradead.org> References: <20200212041845.25879-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: From: "Matthew Wilcox (Oracle)" We can't kmap() a THP, so add a wrapper around zero_user() for large pages. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/highmem.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index ea5cdbd8c2c3..4465b8784353 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -245,6 +245,28 @@ static inline void zero_user(struct page *page, zero_user_segments(page, start, start + size, 0, 0); } =20 +static inline void zero_user_large(struct page *page, + unsigned start, unsigned size) +{ + unsigned int i; + + for (i =3D 0; i < thp_order(page); i++) { + if (start > PAGE_SIZE) { + start -=3D PAGE_SIZE; + } else { + unsigned this_size =3D size; + + if (size > (PAGE_SIZE - start)) + this_size =3D PAGE_SIZE - start; + zero_user(page + i, start, this_size); + start =3D 0; + size -=3D this_size; + if (!size) + break; + } + } +} + #ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE =20 static inline void copy_user_highpage(struct page *to, struct page *from= , --=20 2.25.0