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=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 00E33C352A4 for ; Wed, 5 Feb 2020 11:35:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 858BD217BA for ; Wed, 5 Feb 2020 11:35:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="Cw/B6gNv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 858BD217BA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D9C346B00B5; Wed, 5 Feb 2020 06:35:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D26846B00B7; Wed, 5 Feb 2020 06:35:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C15EA6B00B8; Wed, 5 Feb 2020 06:35:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0178.hostedemail.com [216.40.44.178]) by kanga.kvack.org (Postfix) with ESMTP id A566A6B00B5 for ; Wed, 5 Feb 2020 06:35:30 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 58AA7180AD802 for ; Wed, 5 Feb 2020 11:35:30 +0000 (UTC) X-FDA: 76455868020.29.soup79_4d14aeeccb308 X-HE-Tag: soup79_4d14aeeccb308 X-Filterd-Recvd-Size: 5977 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Wed, 5 Feb 2020 11:35:29 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id b15so1240013lfc.4 for ; Wed, 05 Feb 2020 03:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=9dzJMqCXyJ0/sQ9WqS79itnSpMjlI4okwKhRKzVm4NM=; b=Cw/B6gNv6WrKuynnb0hGrn8XHxmwFGHBK6Kx3ISr6g8541JII8R/dNAUM8FBm3EG/z 7mldHZr7bI2tp5pBfvfOfywWE8+h25kWovFkuNAA2Cj1Nuq4GHdG+S1n6nGJL+Qkvl7u DHVez+FLWMPQTo18ui7XxFbIAVT2/XZW7rBMXmKANw7Z3vjhI+/AgNja35tcKI2QrmWC iB0aW7cfR8lhqyI5gnu4EX1AdRGts8kF7neLmR0wRRiDXDyyZo4cXG1dDMjDe7evtrBV 2VevE1g/382CgqcWrvzbCGiEIdnuWbHFIW8EwV4GVppGEzPCncLDF7f4SZMsf2BMC46d Gxmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=9dzJMqCXyJ0/sQ9WqS79itnSpMjlI4okwKhRKzVm4NM=; b=retk3V3a6YIjwsQcekHqk0qoyjh/b6M43FiWskW9OfFrBPsS14R7WDAWFXqD50RBEc 7lQIsrwzh9TPYlzq7r5f17iUdX4fqQwWwEXxAymjGXmlFF7vk4+4W3pMpKL7Nea4PPgD 3LnL6JNH2fRJKC5IBn4XXBjAzXqbZCJGR9ustifu6QCwz7DjW/67GeRNV9jrQWVtA/Md 8cc+O23YAL+D5cfwqwbdd52+pUK7l3gLXuPRlhdEdFq4H8M60rBzMWdaDSTIghGcrghE dlpReIdJZm8sEBoPVArZp6hkXhwQfsYOYFee8HltBLfXhlITzLHrHfa3WTIuR1hXQ86j Ur8w== X-Gm-Message-State: APjAAAWevYT9c7a9IKgxTXQX5hl7ktUMzoTQuTclQ827eTrvibw+SKrA rDh2WX3P62D5y/b17gQKAgYjAg== X-Google-Smtp-Source: APXvYqy9hnTW8jGEcTDyskMINKlFV9FjmuWaaZRQe2WXLP2287ba30lwKa4xY42Duoj0vvlh1UVC8g== X-Received: by 2002:a19:6b11:: with SMTP id d17mr17471991lfa.168.1580902528148; Wed, 05 Feb 2020 03:35:28 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id f11sm14259401lfa.9.2020.02.05.03.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 03:35:27 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 96D43100AF6; Wed, 5 Feb 2020 14:35:41 +0300 (+03) Date: Wed, 5 Feb 2020 14:35:41 +0300 From: "Kirill A. Shutemov" To: John Hubbard Cc: Andrew Morton , Al Viro , Christoph Hellwig , Dan Williams , Dave Chinner , Ira Weiny , Jan Kara , Jason Gunthorpe , Jonathan Corbet , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Michal Hocko , Mike Kravetz , Shuah Khan , Vlastimil Babka , Matthew Wilcox , linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rdma@vger.kernel.org, linux-mm@kvack.org, LKML , "Kirill A . Shutemov" Subject: Re: [PATCH v4 07/12] mm/gup: track FOLL_PIN pages Message-ID: <20200205113541.mi4kys5erldwxiog@box> References: <20200204234117.2974687-1-jhubbard@nvidia.com> <20200204234117.2974687-8-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20200204234117.2974687-8-jhubbard@nvidia.com> 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 Tue, Feb 04, 2020 at 03:41:12PM -0800, John Hubbard wrote: > Add tracking of pages that were pinned via FOLL_PIN. This tracking is > implemented via overloading of page->_refcount: pins are added by > adding GUP_PIN_COUNTING_BIAS (1024) to the refcount. This provides a > fuzzy indication of pinning, and it can have false positives (and that'= s > OK). Please see the pre-existing > Documentation/core-api/pin_user_pages.rst for details. >=20 > As mentioned in pin_user_pages.rst, callers who effectively set FOLL_PI= N > (typically via pin_user_pages*()) are required to ultimately free such > pages via unpin_user_page(). >=20 > Please also note the limitation, discussed in pin_user_pages.rst under > the "TODO: for 1GB and larger huge pages" section. (That limitation wil= l > be removed in a following patch.) >=20 > The effect of a FOLL_PIN flag is similar to that of FOLL_GET, and may b= e > thought of as "FOLL_GET for DIO and/or RDMA use". >=20 > Pages that have been pinned via FOLL_PIN are identifiable via a > new function call: >=20 > bool page_maybe_dma_pinned(struct page *page); >=20 > What to do in response to encountering such a page, is left to later > patchsets. There is discussion about this in [1], [2], [3], and [4]. >=20 > This also changes a BUG_ON(), to a WARN_ON(), in follow_page_mask(). >=20 > [1] Some slow progress on get_user_pages() (Apr 2, 2019): > https://lwn.net/Articles/784574/ > [2] DMA and get_user_pages() (LPC: Dec 12, 2018): > https://lwn.net/Articles/774411/ > [3] The trouble with get_user_pages() (Apr 30, 2018): > https://lwn.net/Articles/753027/ > [4] LWN kernel index: get_user_pages(): > https://lwn.net/Kernel/Index/#Memory_management-get_user_pages >=20 > Reviewed-by: Jan Kara > Suggested-by: Jan Kara > Suggested-by: J=E9r=F4me Glisse > Cc: Kirill A. Shutemov > Signed-off-by: John Hubbard Acked-by: Kirill A. Shutemov --=20 Kirill A. Shutemov