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.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, 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 AFBBAC3F68F for ; Mon, 3 Feb 2020 13:45:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 741AF20721 for ; Mon, 3 Feb 2020 13:45:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="DURGIzxz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 741AF20721 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 0E8846B0658; Mon, 3 Feb 2020 08:45:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 099396B0659; Mon, 3 Feb 2020 08:45:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEFA66B065A; Mon, 3 Feb 2020 08:45:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id DAFC36B0658 for ; Mon, 3 Feb 2020 08:45:20 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 93DAD824999B for ; Mon, 3 Feb 2020 13:45:20 +0000 (UTC) X-FDA: 76448937600.06.hat74_4ba9389f20316 X-HE-Tag: hat74_4ba9389f20316 X-Filterd-Recvd-Size: 5309 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Mon, 3 Feb 2020 13:45:19 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id o15so9131785ljg.6 for ; Mon, 03 Feb 2020 05:45:19 -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:in-reply-to; bh=IUnQxMQHK0UYauIcgeOHrO2ytoGAz4cOuFspZoniEQM=; b=DURGIzxzZtlePaPxLJuosPF5IgjZvLdBpBnJnfYw6LYoKYQi//fW9+VuRZubXpKrEs 3LMX+Dpp/1wWzauoESO6FvNHyyFvT4ul/xmaQLRrO4IMpiPr5U4TM20F1rk36BsGETrD OAVS3E71vo6UWrJIn/2DbLCgJt0lXqBdU2N+2Guw47TBqPHCoLufJi+bKVRkmIWqivfM zt/fxcxR0rw0vkfLZVGljC++AW9VE8+TNO4ilAZwM87sCtqkbKX4ppGWe913SsRoISk5 efZHmY3oSI37vKDvFb11D4iu7C2qLtXgX0OhF/qKJduP3x4bnKRRtidhdUVeVNILt/cB x37A== 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:in-reply-to; bh=IUnQxMQHK0UYauIcgeOHrO2ytoGAz4cOuFspZoniEQM=; b=GeiWC9Npp0y7S2NmkdRc6LBqAiAO+xDQbO34ijSG1MMDzPZXZwi5mh6N581oqBmjq+ 4Dy2oeeDnm0gdwYKJFgxxEgNAjQXjjFvSUobE/AXAzfBZPI+RQAQtnHxhKhCEuy1JLVl fkxwTPIyaJqMEtNyPzpc8lYH3likuzVPxgWLKS6QA4a/48w59+CGuKyBbo/c1zWzIMEO twyecJkgboVsohqqfEp9tzKWN5lHtrCwrVz9XIwiDAAQ6ipIpye4/KSdzTuD3M0Lgfw/ myiS2A5RtxYGDyl9xB9kogL8tDET7K+xdScGQSX6+iql2FEam67o1zxFckluuP6AYNPZ pgrw== X-Gm-Message-State: APjAAAWwcyxMCsH8outT92SbOhuMDgBM4S+CFT9u/BWgIJrTxdSJjCrf 5h4GsWvUefeiI1XfSkBwa0Xp2Q== X-Google-Smtp-Source: APXvYqz21QOHxuJSZYBWZNueW6EmQAJJS09hunv0rSU3v6P4mQLVjJclJr9NDXL+6UxPq3PhvyF1oA== X-Received: by 2002:a2e:8188:: with SMTP id e8mr14013556ljg.57.1580737518361; Mon, 03 Feb 2020 05:45:18 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id 11sm9941435lju.103.2020.02.03.05.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2020 05:45:17 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id EE551100DC8; Mon, 3 Feb 2020 16:45:29 +0300 (+03) Date: Mon, 3 Feb 2020 16:45:29 +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 Subject: Re: [PATCH v3 08/12] mm/gup: page->hpage_pinned_refcount: exact pin counts for huge pages Message-ID: <20200203134529.onxociznb5mgtjhf@box> References: <20200201034029.4063170-1-jhubbard@nvidia.com> <20200201034029.4063170-9-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200201034029.4063170-9-jhubbard@nvidia.com> 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 Fri, Jan 31, 2020 at 07:40:25PM -0800, John Hubbard wrote: > For huge pages (and in fact, any compound page), the > GUP_PIN_COUNTING_BIAS scheme tends to overflow too easily, each tail > page increments the head page->_refcount by GUP_PIN_COUNTING_BIAS > (1024). That limits the number of huge pages that can be pinned. > > This patch removes that limitation, by using an exact form of pin > counting for compound pages of order > 1. The "order > 1" is required > because this approach uses the 3rd struct page in the compound page, and > order 1 compound pages only have two pages, so that won't work there. Could you update the comment for HPAGE_PMD_ORDER < 2 check in hugepage_init() to reflect addtional user for the condition. > > A new struct page field, hpage_pinned_refcount, has been added, > replacing a padding field in the union (so no new space is used). > > This enhancement also has a useful side effect: huge pages and compound > pages (of order > 1) do not suffer from the "potential false positives" > problem that is discussed in the page_dma_pinned() comment block. That > is because these compound pages have extra space for tracking things, so > they get exact pin counts instead of overloading page->_refcount. > > Documentation/core-api/pin_user_pages.rst is updated accordingly. > > Suggested-by: Jan Kara > Signed-off-by: John Hubbard Acked-by: Kirill A. Shutemov -- Kirill A. Shutemov