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.8 required=3.0 tests=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 D495BC35247 for ; Mon, 3 Feb 2020 15:24:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 82BEC2086A for ; Mon, 3 Feb 2020 15:24:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82BEC2086A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CD2F76B0680; Mon, 3 Feb 2020 10:24:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C5BCB6B0681; Mon, 3 Feb 2020 10:24:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4AEC6B0682; Mon, 3 Feb 2020 10:24:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 9C3986B0680 for ; Mon, 3 Feb 2020 10:24:18 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5212682499A8 for ; Mon, 3 Feb 2020 15:24:18 +0000 (UTC) X-FDA: 76449186996.07.truck24_4299ddb346f0a X-HE-Tag: truck24_4299ddb346f0a X-Filterd-Recvd-Size: 4036 Received: from fireflyinternet.com (unknown [77.68.26.236]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Mon, 3 Feb 2020 15:24:17 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 20101544-1500050 for multiple; Mon, 03 Feb 2020 15:24:14 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: "Kirill A. Shutemov" From: Chris Wilson In-Reply-To: <20200203151844.mmgcwzz3igo7h6wj@box> Cc: "Kirill A. Shutemov" , Andrea Arcangeli , Andrew Morton , Hugh Dickins , Dave Hansen , Mel Gorman , Rik van Riel , Vlastimil Babka , Christoph Lameter , Naoya Horiguchi , Steve Capper , "Aneesh Kumar K.V" , Johannes Weiner , Michal Hocko , Jerome Marchand , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <1426784902-125149-1-git-send-email-kirill.shutemov@linux.intel.com> <1426784902-125149-10-git-send-email-kirill.shutemov@linux.intel.com> <158048425224.2430.4905670949721797624@skylake-alporthouse-com> <20200203151844.mmgcwzz3igo7h6wj@box> Message-ID: <158074345183.25650.17229941243604183055@skylake-alporthouse-com> User-Agent: alot/0.6 Subject: Re: [PATCH 09/16] page-flags: define PG_reserved behavior on compound pages Date: Mon, 03 Feb 2020 15:24:11 +0000 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: Quoting Kirill A. Shutemov (2020-02-03 15:18:44) > On Fri, Jan 31, 2020 at 03:24:12PM +0000, Chris Wilson wrote: > > Quoting Kirill A. Shutemov (2015-03-19 17:08:15) > > > As far as I can see there's no users of PG_reserved on compound pages. > > > Let's use NO_COMPOUND here. > > = > > Much later than you would ever expect, but we just had a user update an > > ancient device and trip over this. > > https://gitlab.freedesktop.org/drm/intel/issues/1027 > > = > > In drm_pci_alloc() we allocate a high-order page (for it to be physical= ly > > contiguous) and mark each page as Reserved. > > = > > dmah->vaddr =3D dma_alloc_coherent(&dev->pdev->dev, size, > > &dmah->busaddr, > > GFP_KERNEL | __GFP_COMP); > > = > > /* XXX - Is virt_to_page() legal for consistent mem? */ > > /* Reserve */ > > for (addr =3D (unsigned long)dmah->vaddr, sz =3D size; > > sz > 0; addr +=3D PAGE_SIZE, sz -=3D PAGE_SIZE) { > > SetPageReserved(virt_to_page((void *)addr)); > > } > > = > > It's been doing that since > > = > > commit ddf19b973be5a96d77c8467f657fe5bd7d126e0f > > Author: Dave Airlie > > Date: Sun Mar 19 18:56:12 2006 +1100 > > = > > drm: fixup PCI DMA support > > = > > I haven't found anything to say if we are meant to be reserving the > > pages or not. So I bring it to your attention, asking for help. > = > I don't see a real reason for these pages to be reserved. But I might be > wrong here. > = > I tried to look around: other users (infiniband/ethernet) of > dma_alloc_coherent(__GFP_COMP) don't mess with PG_reserved. > = > Could you try to drop it from DRM? That is the current plan. So long as there is nothing magical about either the __GFP_COMP or SetPageReserved, we should be able to drop them without any functional change. Only 2 very old bits of HW (r128, ancient i915) depend on this routine, and i915 seems, touch wood, quite happy with a plain dma_alloc_coherent(). -Chris