From patchwork Fri Aug 2 02:19:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john.hubbard@gmail.com X-Patchwork-Id: 11071791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2E3514E5 for ; Fri, 2 Aug 2019 02:20:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B33B52852A for ; Fri, 2 Aug 2019 02:20:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A64F628628; Fri, 2 Aug 2019 02:20:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 106822852A for ; Fri, 2 Aug 2019 02:20:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77D406B026D; Thu, 1 Aug 2019 22:20:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 72BFF6B026E; Thu, 1 Aug 2019 22:20:32 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F7296B026F; Thu, 1 Aug 2019 22:20:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by kanga.kvack.org (Postfix) with ESMTP id 25BAD6B026D for ; Thu, 1 Aug 2019 22:20:32 -0400 (EDT) Received: by mail-pl1-f197.google.com with SMTP id a5so40762792pla.3 for ; Thu, 01 Aug 2019 19:20:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=qtbgyNHZ/W16Wsr49ObVlGXNsYs5Ix8cECAWpHw8QNg=; b=W0Iy836ebfyqLHHZn7hSq2WwsN02Ij0IFTBd4WBAi/BEN/P+h58C5O7qJF5FsTE3ec RuN2F/9USe0dnvIwpHAkPEDqaBwDfUwy+Dw5ljTQDjSjXHaQnfjHe4Uuk4uAk9uZJiOR In7J8QF1OW3JalI2M5nf6f6uoNTxwUR8YRyPCEEhEks8CErEhWipIbJaPCKyFoFi45NF UJjEGgKi1JnUdNG4LD9wLu3tp1n+Uug2Czf69/dSjcHccvhWSnW5NYlO3Kqf3gFm2l39 VTDygYy497cRgCGKn82Xql2Ox/rasvCinvrUjFOLUBsf5mkVR7PXHmKRp1tqCtlqoW0e TrSQ== X-Gm-Message-State: APjAAAXQk7ok8QQFYFCrfc3tLIrXJpkQ1OTKZ9Fax27K8UZ0suhg+EBz obZSvA+tFc2XNRiAjvQofP44KxKzIm12CJ6p52IkXRxsY1eSGiVsLgasJgBZ9CAIojIZwbRA1Zk KY3uEDgB0E6vw9Rt1vnw6txFCkWwi4VPvqKStwooiWtB3prZnHbfwGGaTWGc42dImww== X-Received: by 2002:a17:902:3341:: with SMTP id a59mr10419449plc.186.1564712431796; Thu, 01 Aug 2019 19:20:31 -0700 (PDT) X-Received: by 2002:a17:902:3341:: with SMTP id a59mr10419411plc.186.1564712431090; Thu, 01 Aug 2019 19:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564712431; cv=none; d=google.com; s=arc-20160816; b=rOp6VB8HVjOrPRx2In/gkMX64E5VAnxm0K+AEUucASkgmCzkbrm9t42S2vHwCSvVfd Sl0bOAWnI21vGohxldATHZhuybG5EZazmMiCzU03qbgzyVqBkn6WGekU8jIygiRF/AbE FPMgpx9NItD89gxb49tgu7CV8HNh66dvjiqBhB2ANLzZn+ksXWRI44cNFgniCHQIcTaA 4E/7SjcOnxdSaHcug74IYazgDYSrMUz8FWPyO3hFR0MnBSRzSAFuJfQDK3VDaErgTZ7m iOBUIu/xKdahrz6Je7gjNoEpl07KSL9VwLpxsuRf2jTbxdU9VvO3yJ+SV9SGWJ+Bm0Wg V63A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=qtbgyNHZ/W16Wsr49ObVlGXNsYs5Ix8cECAWpHw8QNg=; b=ze5YRWy290UwH5jphNceSyVjk+xoB4viiKa/E4qQ9edV97mA/WEGeteajmehdDSf1u 03up3Ew3LNhMtk1UBj588BgwMOXGhQCkaEZ+VkqALC9X6zd1czeY/+exbeAupEYE3ncR 5E4DbslZeTIWremaBIgndi6SBMzCcCATMuY2C3ixXtP/0GrAT+H8EAWwvQyzOmvKBVvX +btpCbHlMTc/0RnUSxL1z1FFLBuwG3e+bnmNYtP8Tq0lXu4TPiOQYgVEtDTo9HYqZChL 8XEmANLKfb1Q4VvtABPnIM5IW5xqc4SbwKHaDqr3vEsWgpGJv1YFlSSJ1uJcV5fwM9Ib bYBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RO5t4Ioq; spf=pass (google.com: domain of john.hubbard@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.hubbard@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id ck2sor86124273plb.1.2019.08.01.19.20.30 for (Google Transport Security); Thu, 01 Aug 2019 19:20:31 -0700 (PDT) Received-SPF: pass (google.com: domain of john.hubbard@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RO5t4Ioq; spf=pass (google.com: domain of john.hubbard@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.hubbard@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qtbgyNHZ/W16Wsr49ObVlGXNsYs5Ix8cECAWpHw8QNg=; b=RO5t4Ioq4WOEkql+z1BxTA9XpQ5l0uBsUNJdBVpEbEdDpylZNAFokBSBfkt63Vmsnw KKnFnDLW2SLxaXe4yEcd4Uwphs0F9rh9yrBF7wrtI6jX7Smsup4E8B+OCU5PAghiuPUe n/rru2nRkN4fBDLxv0E5LWIc3+ez3bVuBV4gRzIu0YbbR7/jG/nHlqRg4ui2ABpoKbbs zzA9SmSgidMvseL2Kb+bN8XRYc2qyorbmCL2eKn81WG2j5TabLu8TlIG3hp8Y7Gq/i02 vYgsWfOu94xgHEddrADmlOmkGGALS2TQwhC3ZfS61Jjz+jw13+1q5hfNRcQVjxbv88fI 6ULQ== X-Google-Smtp-Source: APXvYqwKrOY4Kztkj41s0a6oi7zayzaXd8LpjaiCIksbrU4wJsvnJgU6mF0Bb9Hw/Pj5xfTEZIafcQ== X-Received: by 2002:a17:902:5ac4:: with SMTP id g4mr131986648plm.80.1564712430821; Thu, 01 Aug 2019 19:20:30 -0700 (PDT) Received: from blueforge.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id u9sm38179744pgc.5.2019.08.01.19.20.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 19:20:30 -0700 (PDT) From: john.hubbard@gmail.com X-Google-Original-From: jhubbard@nvidia.com To: Andrew Morton Cc: Christoph Hellwig , Dan Williams , Dave Chinner , Dave Hansen , Ira Weiny , Jan Kara , Jason Gunthorpe , =?utf-8?b?SsOpcsO0?= =?utf-8?b?bWUgR2xpc3Nl?= , LKML , amd-gfx@lists.freedesktop.org, ceph-devel@vger.kernel.org, devel@driverdev.osuosl.org, devel@lists.orangefs.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-media@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-xfs@vger.kernel.org, netdev@vger.kernel.org, rds-devel@oss.oracle.com, sparclinux@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, John Hubbard , Arnd Bergmann , Al Viro , "Gustavo A. R. Silva" , Kees Cook Subject: [PATCH 12/34] vmci: convert put_page() to put_user_page*() Date: Thu, 1 Aug 2019 19:19:43 -0700 Message-Id: <20190802022005.5117-13-jhubbard@nvidia.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802022005.5117-1-jhubbard@nvidia.com> References: <20190802022005.5117-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public 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: X-Virus-Scanned: ClamAV using ClamSMTP From: John Hubbard For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages(). This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions"). Note that this effectively changes the code's behavior in qp_release_pages(): it now ultimately calls set_page_dirty_lock(), instead of set_page_dirty(). This is probably more accurate. As Christophe Hellwig put it, "set_page_dirty() is only safe if we are dealing with a file backed page where we have reference on the inode it hangs off." [1] [1] https://lore.kernel.org/r/20190723153640.GB720@lst.de Cc: Arnd Bergmann Cc: Al Viro Cc: "Gustavo A. R. Silva" Cc: Kees Cook Signed-off-by: John Hubbard --- drivers/misc/vmw_vmci/vmci_context.c | 2 +- drivers/misc/vmw_vmci/vmci_queue_pair.c | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c index 16695366ec92..9daa52ee63b7 100644 --- a/drivers/misc/vmw_vmci/vmci_context.c +++ b/drivers/misc/vmw_vmci/vmci_context.c @@ -587,7 +587,7 @@ void vmci_ctx_unset_notify(struct vmci_ctx *context) if (notify_page) { kunmap(notify_page); - put_page(notify_page); + put_user_page(notify_page); } } diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c index 8531ae781195..e5434551d0ef 100644 --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c @@ -626,15 +626,8 @@ static void qp_release_queue_mutex(struct vmci_queue *queue) static void qp_release_pages(struct page **pages, u64 num_pages, bool dirty) { - int i; - - for (i = 0; i < num_pages; i++) { - if (dirty) - set_page_dirty(pages[i]); - - put_page(pages[i]); - pages[i] = NULL; - } + put_user_pages_dirty_lock(pages, num_pages, dirty); + memset(pages, 0, num_pages * sizeof(struct page *)); } /*