From patchwork Wed Aug 7 01:33:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: john.hubbard@gmail.com X-Patchwork-Id: 11080139 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 712831399 for ; Wed, 7 Aug 2019 01:36:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60F3B28837 for ; Wed, 7 Aug 2019 01:36:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54F502888B; Wed, 7 Aug 2019 01:36:14 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E102128837 for ; Wed, 7 Aug 2019 01:36:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvAqt-0001z3-1p; Wed, 07 Aug 2019 01:34:55 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvAqq-0001rq-6E for xen-devel@lists.xenproject.org; Wed, 07 Aug 2019 01:34:52 +0000 X-Inumbo-ID: 8c5140cb-b8b3-11e9-8980-bc764e045a96 Received: from mail-pg1-x543.google.com (unknown [2607:f8b0:4864:20::543]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 8c5140cb-b8b3-11e9-8980-bc764e045a96; Wed, 07 Aug 2019 01:34:50 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id u17so42544431pgi.6 for ; Tue, 06 Aug 2019 18:34:50 -0700 (PDT) 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=iyBF/TunLLNE9m64WGZW5xnvl+XVp1Tkb/4cWK4Q28U=; b=eabm6eV7x6nJ3H6jB3OWHKTAjJ5hccshhWRSvyF8YaL4Xb3kcN3FPSj+mrT7hdf1FM 0MWhm5PqlQFyy6zw76EwLtyOlQEQTOAPUCRq2cKY8d4yFrfincU70ZRfebLbmlijIWR2 wTENuQ2R1ycfB8EIZdvDLYgUy7fahn8NbpOFjvcP7wPItsW4fy1klzu0bIomS6ZhLV9L FATmBTkmPO3bz1bBRYsOrrqOVmLfRrGMChgnyEYGXYwKFOo3GWkjWYe147H72f0kIcVc Tr73f17ZMCrLU+eCYt8HTv90LoBSVz+pg0lUMLNh1TQmkPNzI1sbpCYBSoNZ3shE6svq cn7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iyBF/TunLLNE9m64WGZW5xnvl+XVp1Tkb/4cWK4Q28U=; b=mTGU5i2APoRXZCZvN0oL+9tlL8tpVyJWYo5qqXX+8f+BNIwMlZKS+FzMQZWbQJzYRZ iebiv88zVTvfoNVmxI++LSXKLi8SXwOdp54iDRXJjd51ra+CLvvljthYFxts65Y/w3kb eS2rWoKH1Rodi9MRr9ZXJJVlYaPjOsfaqI0No626xBqRmJH3kv3JQby/TjRvmxXJM4wj scAZMaGz0vRAtS/kDb050Bcx0OL7AN9HvCH9JTG7FbZaTmR+4mlpKzb183xVkEBoIgQv q4FpEQyuAphh8ikc+pYGYK4y+EnFfLBjraSjfLbaqZtb+uNN3Pc15TKmduJGXbulL/2P Y2Lg== X-Gm-Message-State: APjAAAXaJZhrlgrjtvcXxfEgMI1ss9y2n/6aVITe4w/u0VWibEEYAWut D1HYWMn5SgqTwoOGSDNWmTY= X-Google-Smtp-Source: APXvYqz3mrxPCB1S0CW+dxLuweNihe5G+Md2rLL8K5hOTJIrjMzyu1ZdPrsndXXUg8jjoSZHHVCyxA== X-Received: by 2002:a62:14c4:: with SMTP id 187mr6515801pfu.241.1565141690166; Tue, 06 Aug 2019 18:34:50 -0700 (PDT) Received: from blueforge.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id u69sm111740800pgu.77.2019.08.06.18.34.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 06 Aug 2019 18:34:49 -0700 (PDT) From: john.hubbard@gmail.com X-Google-Original-From: jhubbard@nvidia.com To: Andrew Morton Date: Tue, 6 Aug 2019 18:33:40 -0700 Message-Id: <20190807013340.9706-42-jhubbard@nvidia.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190807013340.9706-1-jhubbard@nvidia.com> References: <20190807013340.9706-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Subject: [Xen-devel] [PATCH v3 41/41] mm/ksm: convert put_page() to put_user_page*() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Jan Kara , kvm@vger.kernel.org, Dave Hansen , Dave Chinner , dri-devel@lists.freedesktop.org, linux-mm@kvack.org, Matthew Wilcox , sparclinux@vger.kernel.org, Ira Weiny , ceph-devel@vger.kernel.org, devel@driverdev.osuosl.org, rds-devel@oss.oracle.com, linux-rdma@vger.kernel.org, x86@kernel.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Jason Gunthorpe , xen-devel@lists.xenproject.org, devel@lists.orangefs.org, linux-media@vger.kernel.org, Daniel Black , John Hubbard , intel-gfx@lists.freedesktop.org, linux-block@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-rpi-kernel@lists.infradead.org, Dan Williams , linux-arm-kernel@lists.infradead.org, linux-nfs@vger.kernel.org, netdev@vger.kernel.org, LKML , linux-xfs@vger.kernel.org, linux-crypto@vger.kernel.org, linux-fsdevel@vger.kernel.org, Mike Kravetz Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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"). Cc: Dan Williams Cc: Daniel Black Cc: Jan Kara Cc: Jérôme Glisse Cc: Matthew Wilcox Cc: Mike Kravetz Signed-off-by: John Hubbard --- mm/ksm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 3dc4346411e4..e10ee4d5fdd8 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -456,7 +456,7 @@ static inline bool ksm_test_exit(struct mm_struct *mm) * We use break_ksm to break COW on a ksm page: it's a stripped down * * if (get_user_pages(addr, 1, 1, 1, &page, NULL) == 1) - * put_page(page); + * put_user_page(page); * * but taking great care only to touch a ksm page, in a VM_MERGEABLE vma, * in case the application has unmapped and remapped mm,addr meanwhile. @@ -483,7 +483,7 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr) FAULT_FLAG_WRITE | FAULT_FLAG_REMOTE); else ret = VM_FAULT_WRITE; - put_page(page); + put_user_page(page); } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | VM_FAULT_OOM))); /* * We must loop because handle_mm_fault() may back out if there's @@ -568,7 +568,7 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item) flush_anon_page(vma, page, addr); flush_dcache_page(page); } else { - put_page(page); + put_user_page(page); out: page = NULL; } @@ -1974,10 +1974,10 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item, parent = *new; if (ret < 0) { - put_page(tree_page); + put_user_page(tree_page); new = &parent->rb_left; } else if (ret > 0) { - put_page(tree_page); + put_user_page(tree_page); new = &parent->rb_right; } else if (!ksm_merge_across_nodes && page_to_nid(tree_page) != nid) { @@ -1986,7 +1986,7 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item, * it will be flushed out and put in the right unstable * tree next time: only merge with it when across_nodes. */ - put_page(tree_page); + put_user_page(tree_page); return NULL; } else { *tree_pagep = tree_page; @@ -2328,7 +2328,7 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) &rmap_item->rmap_list; ksm_scan.address += PAGE_SIZE; } else - put_page(*page); + put_user_page(*page); up_read(&mm->mmap_sem); return rmap_item; }