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=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 6FD0DC43215 for ; Mon, 18 Nov 2019 16:57:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 19A72208D4 for ; Mon, 18 Nov 2019 16:57:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="ZZs8QLgb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19A72208D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 732E16B0003; Mon, 18 Nov 2019 11:57:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BEB06B0006; Mon, 18 Nov 2019 11:57:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59A326B0007; Mon, 18 Nov 2019 11:57:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 3D4006B0003 for ; Mon, 18 Nov 2019 11:57:14 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id D3468181AEF0B for ; Mon, 18 Nov 2019 16:57:13 +0000 (UTC) X-FDA: 76170003546.26.toe43_21f8eab69c156 X-HE-Tag: toe43_21f8eab69c156 X-Filterd-Recvd-Size: 4602 Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Mon, 18 Nov 2019 16:57:13 +0000 (UTC) Received: by mail-oi1-f196.google.com with SMTP id l202so15982944oig.1 for ; Mon, 18 Nov 2019 08:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=F2QoGBxbqxKaHdAJPvrt4O/5DoqHAWLSusSXIabi09g=; b=ZZs8QLgb0DGoI+4Ohq8LM3IGXjtQSC4kxA1QwWcD4Za3EBZf+BE3wP72aWJb9897Re l8EwHdLUGZfYNmmFhUr1dT7/l5C75vFfJMR3be0zpoR9seynFhm64osd4ClQ6chd7YGk 6a8ixbDjDsWRVMiY50w+KObtQpOTxJ/kLYNOgA1Xc/kxL0bihi9PSMWhoKFRAIXkTWhj uV7YSXY3fWllNgIyQEy1sJC/Ne2NO2c9Lcddcu2Nx543vj/8d1QqBq+BmppqX2r+QGu0 ySlU18Hbsf2Zg0yhbJ0WcaIFmHOlEL+cXMYMu/ynuLKdzVpMoIcbRbbr/g++sg5n6/Rp IfBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=F2QoGBxbqxKaHdAJPvrt4O/5DoqHAWLSusSXIabi09g=; b=Ve0FLbZlNsk1pqWPFR8jlHoYC0woD+4XCKPUFIt+SlKZCUL75UgWEHIGGnkEHrye4b E45quCwxtjPSgMXkiNvCtwKhqKYSAH8G6Kw/nEqjOPacAr8etRP36p4jZL2j5IH7JqdG gfkprcChlktoFBauuTyfikpNkl3MqHuL9LyG34ohAMOaqNYGNJ6k9audUBj1WUN7J1Xr RvhkxZTpV1tOwHZyy7JIo3Qg7lrnoaHnuqFwFF0KEFD3H4OSub3fcOF7Ix6INTDQQ+8K cD+i4IrQBjgMnH4rF8trjCFLw/YG0PnUjTRGBsbPhek+GMQpyYzpvX7y7Ws64h3ynIKa s9sw== X-Gm-Message-State: APjAAAXPB1i+6vgMBwthdfg1tDpphwrynRt26TIyr2wG3F2jXo7LZDjW PxX7sXyySCOMQrNH4Foxy+YyyowIOLGPCLW6Dol12A== X-Google-Smtp-Source: APXvYqzxVz2ITPsmL7BIllg6yzJCnkn09mUhU51YguSZB4HFRO8vRYA3KeNXnspk2IZU9U52ryt0kS3aQ71VvEQofWA= X-Received: by 2002:aca:55c1:: with SMTP id j184mr22494640oib.105.1574096232626; Mon, 18 Nov 2019 08:57:12 -0800 (PST) MIME-Version: 1.0 References: <20191115001134.2489505-1-jhubbard@nvidia.com> <20191115001134.2489505-3-jhubbard@nvidia.com> <20191118070826.GB3099@infradead.org> In-Reply-To: <20191118070826.GB3099@infradead.org> From: Dan Williams Date: Mon, 18 Nov 2019 08:57:01 -0800 Message-ID: Subject: Re: [PATCH 2/2] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages To: Christoph Hellwig Cc: John Hubbard , Andrew Morton , Jan Kara , Jason Gunthorpe , Jens Axboe , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , linux-nvdimm , Linux MM , LKML , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" 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: On Sun, Nov 17, 2019 at 11:09 PM Christoph Hellwig wrot= e: > > On Thu, Nov 14, 2019 at 04:11:34PM -0800, John Hubbard wrote: > > An upcoming patch changes and complicates the refcounting and > > especially the "put page" aspects of it. In order to keep > > everything clean, refactor the devmap page release routines: > > > > * Rename put_devmap_managed_page() to page_is_devmap_managed(), > > and limit the functionality to "read only": return a bool, > > with no side effects. > > > > * Add a new routine, put_devmap_managed_page(), to handle checking > > what kind of page it is, and what kind of refcount handling it > > requires. > > > > * Rename __put_devmap_managed_page() to free_devmap_managed_page(), > > and limit the functionality to unconditionally freeing a devmap > > page. > > > > This is originally based on a separate patch by Ira Weiny, which > > applied to an early version of the put_user_page() experiments. > > Since then, J=C3=A9r=C3=B4me Glisse suggested the refactoring described= above. > > I can't say I'm a big fan of this as it adds a lot more inlined > code to put_page, which has a lot of callsites. Can't we instead > try to figure out a way to move away from the off by one refcounting? That might be possible. David and I are discussing a pfn_online() helper that might be a replacement for keeping ZONE_DEVICE pages out of the page allocator rather than keeping their reference count elevated.