From patchwork Tue Jan 15 18:12:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Davidlohr Bueso X-Patchwork-Id: 10764917 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 7775713B4 for ; Tue, 15 Jan 2019 18:13:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64F062D4AD for ; Tue, 15 Jan 2019 18:13:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 544932D4D8; Tue, 15 Jan 2019 18:13:27 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEEE62D467 for ; Tue, 15 Jan 2019 18:13:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729915AbfAOSN0 (ORCPT ); Tue, 15 Jan 2019 13:13:26 -0500 Received: from smtp2.provo.novell.com ([137.65.250.81]:50768 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727667AbfAOSN0 (ORCPT ); Tue, 15 Jan 2019 13:13:26 -0500 Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Tue, 15 Jan 2019 11:13:17 -0700 From: Davidlohr Bueso To: akpm@linux-foundation.org Cc: dledford@redhat.com, jgg@mellanox.com, linux-rdma@vger.kernel.org, linux-mm@kvack.org, dave@stgolabs.net Subject: [PATCH -next 0/6] mm: make pinned_vm atomic and simplify users Date: Tue, 15 Jan 2019 10:12:54 -0800 Message-Id: <20190115181300.27547-1-dave@stgolabs.net> X-Mailer: git-send-email 2.16.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, The following patches aim to provide cleanups to users that pin pages (mostly infiniband) by converting the counter to atomic -- note that Daniel Jordan also has patches[1] for the locked_vm counterpart and vfio. Apart from removing a source of mmap_sem writer, we benefit in that we can get rid of a lot of code that defers work when the lock cannot be acquired, as well as drivers avoiding mmap_sem altogether by also converting gup to gup_fast() and letting the mm handle it. Users that do the gup_longterm() remain of course under at least reader mmap_sem. Everything has been compile-tested _only_ so I hope I didn't do anything too stupid. Please consider for v5.1. On a similar topic and potential follow up, it would be nice to resurrect Peter's VM_PINNED idea in that the broken semantics that occurred after bc3e53f682 ("mm: distinguish between mlocked and pinned pages") are still present. Also encapsulating internal mm logic via mm[un]pin() instead of drivers having to know about internals and playing nice with compaction are all wins. Thanks! [1] https://lkml.org/lkml/2018/11/5/854 Davidlohr Bueso (6): mm: make mm->pinned_vm an atomic counter mic/scif: do not use mmap_sem drivers/IB,qib: do not use mmap_sem drivers/IB,hfi1: do not se mmap_sem drivers/IB,usnic: reduce scope of mmap_sem drivers/IB,core: reduce scope of mmap_sem drivers/infiniband/core/umem.c | 47 +++----------------- drivers/infiniband/hw/hfi1/user_pages.c | 12 ++--- drivers/infiniband/hw/qib/qib_user_pages.c | 69 ++++++++++------------------- drivers/infiniband/hw/usnic/usnic_ib_main.c | 2 - drivers/infiniband/hw/usnic/usnic_uiom.c | 56 +++-------------------- drivers/infiniband/hw/usnic/usnic_uiom.h | 1 - drivers/misc/mic/scif/scif_rma.c | 38 +++++----------- fs/proc/task_mmu.c | 2 +- include/linux/mm_types.h | 2 +- kernel/events/core.c | 8 ++-- kernel/fork.c | 2 +- mm/debug.c | 3 +- 12 files changed, 57 insertions(+), 185 deletions(-)