Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3943518ybl; Mon, 3 Feb 2020 09:27:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwdWGyJQk5hd6TgFU/2UBkeYbUfojb3pszdYokDZS8l1JTckaeCYB5xu2kwRbAYf8K43hfe X-Received: by 2002:a05:6808:b15:: with SMTP id s21mr71083oij.123.1580750851552; Mon, 03 Feb 2020 09:27:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580750851; cv=none; d=google.com; s=arc-20160816; b=gV9hPC+jg7U/Au5p/JA0XgDqNMw+I5OygpWJNJLPcOQ0hu/CZmob0tp0BO8skGmwDG DikLaEZeRVLpnxiOt6bKpsFXHOa0CmSlIJ7PoJGQySU9L/gXAqNXmHzp+CSGQOLFsc8p TUqn5LPs+uHBvFE0JD8EhyQLj2IJs4gK+BbxJEOdq+REW15e/e45ypOlk6vp/BDLcfk6 Exk4CxkbJJMq4K4VMhlI97wCvapgQz5wvTe+dUlcXgtKhuy2HJFV4CSpNNhVW79m5Pe2 jlt/DZ/bLA5Jpdu+ze9H6EToMTW45uEJadC1+/06wAIi5qzeuuUfq4Uyy+Qmo8DqziY9 Z4hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version; bh=juKEIl+A1gYxb0smS8n3nPrMhSc1NZW+ts7r2xGn6iU=; b=Xh69+xAsSTQrh9Vp70Ro0/38n4eArloZmi59AkptpU0tfYz1h37JoDoG4ssc/7Qt7K 4AlmMA0AwkLw7IACGLixDVkl1NyYE/bwACRVkXkhmTMtRGcPMAlP/LsA2OsOz2WB5JFI nVzuhk8iew1CGOtgFImJ308mbAA3VR16rs84lRyPAB5DPh7Jam4a9revgSvTS+pVwOcm r/xUIH+PLOo73l4zugDKP7EDtv/XtaA0nwUwV5a4IzyMuTcwd/kkQvrlESRKj7vwfVjq OMf3uFuDAEH3TlyXSFNADxydIdMKbYfi7QB6kK4H8i5ySAshKzJrkMfayMgdgD0U7W/y NUrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q17si4365120otk.321.2020.02.03.09.27.17; Mon, 03 Feb 2020 09:27:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728031AbgBCPYW convert rfc822-to-8bit (ORCPT + 99 others); Mon, 3 Feb 2020 10:24:22 -0500 Received: from mail.fireflyinternet.com ([77.68.26.236]:50832 "EHLO fireflyinternet.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727646AbgBCPYW (ORCPT ); Mon, 3 Feb 2020 10:24:22 -0500 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: 8BIT 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 physically > > contiguous) and mark each page as Reserved. > > > > dmah->vaddr = 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 = (unsigned long)dmah->vaddr, sz = size; > > sz > 0; addr += PAGE_SIZE, sz -= 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