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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 C7EBEC2D0CD for ; Wed, 18 Dec 2019 15:52:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98DC02176D for ; Wed, 18 Dec 2019 15:52:27 +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="KDdHHJJR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726985AbfLRPw1 (ORCPT ); Wed, 18 Dec 2019 10:52:27 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:36749 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726987AbfLRPwO (ORCPT ); Wed, 18 Dec 2019 10:52:14 -0500 Received: by mail-lj1-f195.google.com with SMTP id r19so2704798ljg.3 for ; Wed, 18 Dec 2019 07:52:12 -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:user-agent; bh=9SaCbmKz1ngtAKjewhoah2l6ODU7+VciCnZ7nlhe26A=; b=KDdHHJJR0qVpHZqAH81m6HqiNucHS6+DyOVljs3zJhGM2FtVdbdAm0v2Xxx2kkMzcc COndoaW+YFAjiesHFNY+QGvBhkVduyh7QLCQeLwcNzFcgoRSyGgSLcKxln6/f1EUD6yP 0y/6+ZumAIbzC9iZaVPFSydS1BkjYoeUFSafS/fB2OWFlpyQaG5ZPEXYvAMbIqCKuFSL vWtk3rEHKc5uyahuOPC2nUQfw14PqKcbFsQXhuikgf46s/H3eDyiCMpavZwnwbAsy3mj YXZ/SZZpNe1V4549MQIslp0gnIgv8CLO8jjGejFKXWpzPMIfXWxDiYo5N9hhWPoVV8yK Z+eQ== 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:user-agent; bh=9SaCbmKz1ngtAKjewhoah2l6ODU7+VciCnZ7nlhe26A=; b=TjIIXM0p/d9dDCkfbCYpXhk1GSiyEj2tdnm5aJVqjNfzQed0Mx8/Pya5hwRN6/SAcr +PWBbmSHQ5ojZOOTs1+LWefkHHr+0FDiYgQ7LTw8L94N/4J/CNi8son41LoHN81fXPFN 4zGBYAyN4UE/Bd54Gur+rQ3Mm+5dKHWVG84tIdF4/lgl7beVxtBlrIgvj863UCMpKspz 0bhzy0vIJ9vd3ON3P186RrZU8T6gQyAzRSPc42rL1pYeRoPXl7mHqlLGsCOVg1zrPMOh L4IR2LqHA12nM+HzQj0kVQyK4gmE1QpfNePgcyLA9gY+TXluuCgockDr9uDAY0yJBUJW 1dDA== X-Gm-Message-State: APjAAAVSv3O0cslADs+A7LdvHqSmaj0i9POVeXwqUfjmaVSA7pNvqnyE 5kyxd3HrwaPP0v116ltMDzJ8ZA== X-Google-Smtp-Source: APXvYqwSmzkDxFfUqfRx+ol+ctreHSER3AZEkxHGbqQ5sNtLr5I/0+mwtD90Owb4uveY0c44Ujy5Kw== X-Received: by 2002:a2e:3312:: with SMTP id d18mr2333248ljc.222.1576684332255; Wed, 18 Dec 2019 07:52:12 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id s16sm1351312lfc.35.2019.12.18.07.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 07:52:11 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 66C2E1012CF; Wed, 18 Dec 2019 18:52:11 +0300 (+03) Date: Wed, 18 Dec 2019 18:52:11 +0300 From: "Kirill A. Shutemov" To: John Hubbard Cc: Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jan Kara , Jason Gunthorpe , Jens Axboe , Jonathan Corbet , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko , Mike Kravetz , Paul Mackerras , Shuah Khan , Vlastimil Babka , bpf@vger.kernel.org, dri-devel@lists.freedesktop.org, kvm@vger.kernel.org, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, linux-rdma@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, linux-mm@kvack.org, LKML , Christoph Hellwig , "Aneesh Kumar K . V" Subject: Re: [PATCH v11 01/25] mm/gup: factor out duplicate code from four routines Message-ID: <20191218155211.emcegdp5uqgorfwe@box> References: <20191216222537.491123-1-jhubbard@nvidia.com> <20191216222537.491123-2-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191216222537.491123-2-jhubbard@nvidia.com> User-Agent: NeoMutt/20180716 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Mon, Dec 16, 2019 at 02:25:13PM -0800, John Hubbard wrote: > +static void put_compound_head(struct page *page, int refs) > +{ > + /* Do a get_page() first, in case refs == page->_refcount */ > + get_page(page); > + page_ref_sub(page, refs); > + put_page(page); > +} It's not terribly efficient. Maybe something like: VM_BUG_ON_PAGE(page_ref_count(page) < ref, page); if (refs > 2) page_ref_sub(page, refs - 1); put_page(page); ? -- Kirill A. Shutemov 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=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 BB61BC43603 for ; Wed, 18 Dec 2019 15:54:23 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 376082146E for ; Wed, 18 Dec 2019 15:54:23 +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="KDdHHJJR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 376082146E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47dKM06l61zDqjW for ; Thu, 19 Dec 2019 02:54:20 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=shutemov.name (client-ip=2a00:1450:4864:20::244; helo=mail-lj1-x244.google.com; envelope-from=kirill@shutemov.name; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="KDdHHJJR"; dkim-atps=neutral Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47dKJj0lNYzDqgb for ; Thu, 19 Dec 2019 02:52:15 +1100 (AEDT) Received: by mail-lj1-x244.google.com with SMTP id a13so2682166ljm.10 for ; Wed, 18 Dec 2019 07:52:15 -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:user-agent; bh=9SaCbmKz1ngtAKjewhoah2l6ODU7+VciCnZ7nlhe26A=; b=KDdHHJJR0qVpHZqAH81m6HqiNucHS6+DyOVljs3zJhGM2FtVdbdAm0v2Xxx2kkMzcc COndoaW+YFAjiesHFNY+QGvBhkVduyh7QLCQeLwcNzFcgoRSyGgSLcKxln6/f1EUD6yP 0y/6+ZumAIbzC9iZaVPFSydS1BkjYoeUFSafS/fB2OWFlpyQaG5ZPEXYvAMbIqCKuFSL vWtk3rEHKc5uyahuOPC2nUQfw14PqKcbFsQXhuikgf46s/H3eDyiCMpavZwnwbAsy3mj YXZ/SZZpNe1V4549MQIslp0gnIgv8CLO8jjGejFKXWpzPMIfXWxDiYo5N9hhWPoVV8yK Z+eQ== 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:user-agent; bh=9SaCbmKz1ngtAKjewhoah2l6ODU7+VciCnZ7nlhe26A=; b=eygEsmge+SjAIxQbkstVDv6l1NZkIAZz/vMoOpu4BccG3mg2mDGqbxuSILTep+oLrF YHqaUWQ1BDD2cLr7bRq+LP5rv/TceNCqoQiweX9XFGwJi4ZvViIGlL/PjnKhvmvtItFu LRxQ3+DQTtpc7xQlZrDozCG+g+uKPCT+iQ9X5G+pkm7iDJlgKY82wEN0JN3WH+T3Z6P4 +T//885lH+Srumfa+ysyWMlXLwo7C8voDcSnFfmSU1IaOagOc/Ls1HBJ1HVWunUFn8X8 N86kQPiWBA0BO8zpK7XGxKthISK9JrWM1fzose2nhMvCVYYjCkv4g9hCXU52JvalatFx KW6Q== X-Gm-Message-State: APjAAAU7xgDzDty93ZYig/xplK68GN67OOk5B/i6aD9y1Gt1kaPBeFDp bO+ntBbDUHLK7OE/BZRkjiTmyA== X-Google-Smtp-Source: APXvYqwSmzkDxFfUqfRx+ol+ctreHSER3AZEkxHGbqQ5sNtLr5I/0+mwtD90Owb4uveY0c44Ujy5Kw== X-Received: by 2002:a2e:3312:: with SMTP id d18mr2333248ljc.222.1576684332255; Wed, 18 Dec 2019 07:52:12 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id s16sm1351312lfc.35.2019.12.18.07.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 07:52:11 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 66C2E1012CF; Wed, 18 Dec 2019 18:52:11 +0300 (+03) Date: Wed, 18 Dec 2019 18:52:11 +0300 From: "Kirill A. Shutemov" To: John Hubbard Subject: Re: [PATCH v11 01/25] mm/gup: factor out duplicate code from four routines Message-ID: <20191218155211.emcegdp5uqgorfwe@box> References: <20191216222537.491123-1-jhubbard@nvidia.com> <20191216222537.491123-2-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191216222537.491123-2-jhubbard@nvidia.com> User-Agent: NeoMutt/20180716 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , Jan Kara , kvm@vger.kernel.org, linux-doc@vger.kernel.org, David Airlie , Dave Chinner , dri-devel@lists.freedesktop.org, LKML , linux-mm@kvack.org, Paul Mackerras , linux-kselftest@vger.kernel.org, Ira Weiny , Christoph Hellwig , Jonathan Corbet , linux-rdma@vger.kernel.org, Christoph Hellwig , Jason Gunthorpe , Vlastimil Babka , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , linux-media@vger.kernel.org, Shuah Khan , linux-block@vger.kernel.org, =?utf-8?B?SsOpcsO0bWU=?= Glisse , Al Viro , Dan Williams , Mauro Carvalho Chehab , bpf@vger.kernel.org, Magnus Karlsson , Jens Axboe , netdev@vger.kernel.org, Alex Williamson , Daniel Vetter , "Aneesh Kumar K . V" , linux-fsdevel@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S . Miller" , Mike Kravetz Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Dec 16, 2019 at 02:25:13PM -0800, John Hubbard wrote: > +static void put_compound_head(struct page *page, int refs) > +{ > + /* Do a get_page() first, in case refs == page->_refcount */ > + get_page(page); > + page_ref_sub(page, refs); > + put_page(page); > +} It's not terribly efficient. Maybe something like: VM_BUG_ON_PAGE(page_ref_count(page) < ref, page); if (refs > 2) page_ref_sub(page, refs - 1); put_page(page); ? -- Kirill A. Shutemov 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=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 93CA3C3F68F for ; Wed, 18 Dec 2019 15:52:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67F952176D for ; Wed, 18 Dec 2019 15:52:15 +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="KDdHHJJR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67F952176D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8ECF6E083; Wed, 18 Dec 2019 15:52:14 +0000 (UTC) Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id E73B96E083 for ; Wed, 18 Dec 2019 15:52:13 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id u1so2689815ljk.7 for ; Wed, 18 Dec 2019 07:52:13 -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:user-agent; bh=9SaCbmKz1ngtAKjewhoah2l6ODU7+VciCnZ7nlhe26A=; b=KDdHHJJR0qVpHZqAH81m6HqiNucHS6+DyOVljs3zJhGM2FtVdbdAm0v2Xxx2kkMzcc COndoaW+YFAjiesHFNY+QGvBhkVduyh7QLCQeLwcNzFcgoRSyGgSLcKxln6/f1EUD6yP 0y/6+ZumAIbzC9iZaVPFSydS1BkjYoeUFSafS/fB2OWFlpyQaG5ZPEXYvAMbIqCKuFSL vWtk3rEHKc5uyahuOPC2nUQfw14PqKcbFsQXhuikgf46s/H3eDyiCMpavZwnwbAsy3mj YXZ/SZZpNe1V4549MQIslp0gnIgv8CLO8jjGejFKXWpzPMIfXWxDiYo5N9hhWPoVV8yK Z+eQ== 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:user-agent; bh=9SaCbmKz1ngtAKjewhoah2l6ODU7+VciCnZ7nlhe26A=; b=o61rTSxNZgIC/x02h6n2aobL7D6bqQ6rVQ8QSqerWLeS/hQmUH6l2QwYPhFEyndjXo z7aIb9z5eCXgbnGn9sQ8wFheLCow04Uc87mE+/uQqhC+rDNu4C0aDwGjQHC0Q/69XZZn 0ZbXq26yeec2+y0iiESL38xhyHRQYodm8pmwxx/NDLD1s57nHOYTLZ0CadPc+lpM5kiY /yQss9pvQNrnHyimWSx9jtXuPI9T7VRJKgLGkxeR3G/2M/h2kGN+pyxlcYCqVqpXfeqT iq9b4lWyy6GfhmwiHMxFRkLvGnRNy278uOgzFLBvFLWxBoLoDs3/MY9DVh9zQ/EnAKp6 HyZg== X-Gm-Message-State: APjAAAWWDCfs5qM83kHh0h8+jjFkPxByfSQxF/Q7+N/aGIqKQmvBJ/IU zpwg8JryfEJOPjbsL7BfTo5rQg== X-Google-Smtp-Source: APXvYqwSmzkDxFfUqfRx+ol+ctreHSER3AZEkxHGbqQ5sNtLr5I/0+mwtD90Owb4uveY0c44Ujy5Kw== X-Received: by 2002:a2e:3312:: with SMTP id d18mr2333248ljc.222.1576684332255; Wed, 18 Dec 2019 07:52:12 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id s16sm1351312lfc.35.2019.12.18.07.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 07:52:11 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 66C2E1012CF; Wed, 18 Dec 2019 18:52:11 +0300 (+03) Date: Wed, 18 Dec 2019 18:52:11 +0300 From: "Kirill A. Shutemov" To: John Hubbard Subject: Re: [PATCH v11 01/25] mm/gup: factor out duplicate code from four routines Message-ID: <20191218155211.emcegdp5uqgorfwe@box> References: <20191216222537.491123-1-jhubbard@nvidia.com> <20191216222537.491123-2-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191216222537.491123-2-jhubbard@nvidia.com> User-Agent: NeoMutt/20180716 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , Jan Kara , kvm@vger.kernel.org, linux-doc@vger.kernel.org, David Airlie , Dave Chinner , dri-devel@lists.freedesktop.org, LKML , linux-mm@kvack.org, Paul Mackerras , linux-kselftest@vger.kernel.org, Ira Weiny , Christoph Hellwig , Jonathan Corbet , linux-rdma@vger.kernel.org, Michael Ellerman , Christoph Hellwig , Jason Gunthorpe , Vlastimil Babka , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , linux-media@vger.kernel.org, Shuah Khan , linux-block@vger.kernel.org, =?utf-8?B?SsOpcsO0bWU=?= Glisse , Al Viro , Dan Williams , Mauro Carvalho Chehab , bpf@vger.kernel.org, Magnus Karlsson , Jens Axboe , netdev@vger.kernel.org, Alex Williamson , "Aneesh Kumar K . V" , linux-fsdevel@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S . Miller" , Mike Kravetz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Dec 16, 2019 at 02:25:13PM -0800, John Hubbard wrote: > +static void put_compound_head(struct page *page, int refs) > +{ > + /* Do a get_page() first, in case refs == page->_refcount */ > + get_page(page); > + page_ref_sub(page, refs); > + put_page(page); > +} It's not terribly efficient. Maybe something like: VM_BUG_ON_PAGE(page_ref_count(page) < ref, page); if (refs > 2) page_ref_sub(page, refs - 1); put_page(page); ? -- Kirill A. Shutemov _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel