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: 10764923 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 438E96C5 for ; Tue, 15 Jan 2019 18:13:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 363F02D467 for ; Tue, 15 Jan 2019 18:13:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A3592D4D8; Tue, 15 Jan 2019 18:13:29 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable 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 C99FA2D4AD for ; Tue, 15 Jan 2019 18:13:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDE1B8E0003; Tue, 15 Jan 2019 13:13:27 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D62A88E0002; Tue, 15 Jan 2019 13:13:27 -0500 (EST) 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 BDF318E0003; Tue, 15 Jan 2019 13:13:27 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id 7480C8E0002 for ; Tue, 15 Jan 2019 13:13:27 -0500 (EST) Received: by mail-pg1-f197.google.com with SMTP id m16so2182264pgd.0 for ; Tue, 15 Jan 2019 10:13:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=5RuFJJrdKWBGFyOEqixMcpXjMarz79t5xgn7notkunc=; b=tZbzd18ZDaokR7obkChUdtRWw2rhJsOpJkR97vYSMLJCaeAeiPD3A9IOKb+LumoH0u xkRvUU1CIf15bDFN48m00RUPv9FzshghKFpa/JNXxXQY32Xa4bvWnZM+nqiHlKzvwMNc nsK6+NW6IG0XNDM6P5AeLXJyeGVUzg+glQAASF61f5VLsLL7CqoZ8rtOazOyVbAdpLbw BQtFrWMkxedIkofen9h8v4Y8kGxyKYx0aRv2h33wVD97fFPvw+l/sGrsJ7bbhh+YXD42 IcWJUrjGA+KzW/1OJWTbHmul5teEk06zaXMfJcO4erWdxPVxbZ3HR5IxLdhVmwRveYVA 75MA== X-Original-Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning dave@stgolabs.net does not designate 137.65.250.81 as permitted sender) smtp.mailfrom=dave@stgolabs.net X-Gm-Message-State: AJcUukfSmuo9OrTu02ttHATmDKhRdye1PPE1J5v0ooAkG0qe0d3vBdSm otxGMZBgId+fmNrYMlkN1gcdN6yq9TZRYk0TcDlmZv9ry0Ewk52KyRtqp8ykWTmrXJKZZ2+Ksj5 8RmxVR0KNdtcJTYZycuQEU4VZ43I1GN0Lmi6OWvq5of9l6n6Q9sC73yow5aZpsCM= X-Received: by 2002:a17:902:bc81:: with SMTP id bb1mr5265290plb.223.1547576007076; Tue, 15 Jan 2019 10:13:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN6cjnLTpyg90Se6/wMGf8BI1OaiODQNAWdCaooeBcauRDHCQTlgHu+9deqafukLGFmbHnWk X-Received: by 2002:a17:902:bc81:: with SMTP id bb1mr5265226plb.223.1547576006159; Tue, 15 Jan 2019 10:13:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547576006; cv=none; d=google.com; s=arc-20160816; b=sysqNDI568mW4Fn7yGwkBho2F8v1FqDM3Kl3HGFoslnjw7dLB0Obw9/WvT0Ai6bJAt 8xDMwMJjwTokU/LKweRaJKbYPfmyQ/PFL23OTekFAJIOiY7cd3hakY3PJbo9xrpd/4Xn tn/0zdAHmugU4mMuoJUISowsxf37mGvgi0RjqupIj1Q+NFSm+pHuu7dzYd5a46oeXnBS rObllyoQezxa9Hcj5okrVW5VWM91oIj5SNQUo1/Jfj+6Oekj0bWAntP7tmr91Gabedh3 AaSFlrG9cTMHAsS64dtAnbXlqU0rPk44ya2fU0kxjWTNO+9BfQIla70RcDCWLPX5hGcj IBQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=5RuFJJrdKWBGFyOEqixMcpXjMarz79t5xgn7notkunc=; b=E5kaerqRErBUCdCde0lMAcap2g7BKSkUb6oVsSRWg51jbFbABrnKkwIEpQCk4oS8Em pBa+Gm05wUf/eic1pHMQRwURUej3MjVuPme+OV7gU0RiNnZKoB9iStnkJJADYziza0Km wHrSiLqdOmyBTgB2ycv8fdbvk3gZOxI1yIQMPgpDHtNqAeTpbMorNg9XCNLrR0FXE44Z UqQXalaVZfeBnYELZ9xgvtrbbibwP2Ux8A4km9j6dsjQbT+0vHH5wTOjugL/B994g1pC Otm85i196+/juz6JCmI6KNJfJtzjE1urK+MxAZtYLB7eeyfBuHBIUxkc4QOnBWxPog5S IEHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning dave@stgolabs.net does not designate 137.65.250.81 as permitted sender) smtp.mailfrom=dave@stgolabs.net Received: from smtp2.provo.novell.com (smtp2.provo.novell.com. [137.65.250.81]) by mx.google.com with ESMTPS id b21si1758966pfb.89.2019.01.15.10.13.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jan 2019 10:13:26 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning dave@stgolabs.net does not designate 137.65.250.81 as permitted sender) client-ip=137.65.250.81; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning dave@stgolabs.net does not designate 137.65.250.81 as permitted sender) smtp.mailfrom=dave@stgolabs.net 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 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 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(-) Reviewed-by: Ira Weiny