Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1273234pxf; Fri, 12 Mar 2021 06:14:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIiGQDeh3M5LzG5MGzvmMY/Nn65YL1QljUxhiepXGY76he0/ZUqRXNcm/83Zar61/6Pt8A X-Received: by 2002:a17:906:2692:: with SMTP id t18mr8552440ejc.16.1615558470785; Fri, 12 Mar 2021 06:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615558470; cv=none; d=google.com; s=arc-20160816; b=pGevztyo/CmCEjUClWDs61so4q/wvuGBiWC5sI+akg0hm1PBpFDVE0lAXE7yIxAmwc 2N5RxHKrJwbk2DWLTppX6DYAxLu5prsf0U70W9fSNXvQC33JfclGwqKrDg7Ft1GhsJM/ /0Yb47cTQ2IzSp4iOfxi3Twx/D/qTWeMj4WkLbCexV0MPhlkkwVWHFO+O5YblXxRhpBp fhOfJje8sbqeRsqyxHKH5hWxSY/IXk4FNaNeG+73IaLWGeR28iGZf/hxOQ/hp8nZoSjS VTw58vU9EGySExlmblLIb/kURzNiS1YYKrWnXQdHA8oybiuZGEa+7GUwTXRrnBtviN+a cRVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=FS8E3QfSbLNuEUx0oGFG0GGmNvYIycOcmcrDH3zq20s=; b=UY30szYFfOxI8suYkhE0A8nsdWNj4PYhONh9yp/GEeBuE8ney0mD/OLUHTXRw7cFjZ zMIkN5FQAk/4mjzZ54eeLXEvpaU9a22/y/ymzeVsTOJ4uJLrL5fRYP+jz0EDTL0joPQZ VeqqOBVwfI3SJH4m/nFryCI0cCwiwriJc4+blOpq8aEKgb6s9fmya5iH7N22sPq8Gp2h eKDnf0NYaUWGJxug+DeWaSrl6OIeL+MkMfZODx1zvKDhw+fiKsuJrB/E3GxAj07m2c83 yu74j3Me1T7v2lM0RDHJXnyAPbgu6D1gpBL71l72Yfs5HhHGdtEEmRHOGIepyI1F8zK6 EKaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=EpXn29EL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si4148716edb.385.2021.03.12.06.14.01; Fri, 12 Mar 2021 06:14:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=EpXn29EL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231781AbhCLOM7 (ORCPT + 99 others); Fri, 12 Mar 2021 09:12:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbhCLOMc (ORCPT ); Fri, 12 Mar 2021 09:12:32 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91C3C061761 for ; Fri, 12 Mar 2021 06:12:31 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id r15-20020a05600c35cfb029010e639ca09eso15889276wmq.1 for ; Fri, 12 Mar 2021 06:12:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=FS8E3QfSbLNuEUx0oGFG0GGmNvYIycOcmcrDH3zq20s=; b=EpXn29ELHwyLOmSmA0dpAkvkzt6uQd+2W1sVUIUHPfGbws8JaoUARChu8bwZ+ySzEi nCr0fmdzZQeLZKtpf+sy93qveuEeBtDIH1nlt0EaWvvaxRUMiX+UBQeY9QSHzzh7fC1w qkTT5+yV7aj5TuQgL7jb9WbbOMqqtVTntSsrE= 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=FS8E3QfSbLNuEUx0oGFG0GGmNvYIycOcmcrDH3zq20s=; b=AIguQnMOlP0uIjRQCGdkn236qpBIkgqcsG9jOgKHPlpWAy7fzeBAjrw71AcLFwfxw4 9Lkqs2ppOs/vfKwaJntLqpIdgrs0Ax+tGzuBPPfwgpedPsR+4SvQT64EGSZ/7IQMHpCZ vlMNH5rA6Ab+P2WYt6d9WUbyLrgyiYxboLk6uSYhimG9Px6e+6Zydv45DFR/SeOd5tGK CWps7P0KGZqFlnPPvcDeyvCDNon4eXUiitQzb0uHQjkgtjcjjeAdsm8LWXO9kGy187Uk iPKHjJgO0DEi1Z5BtQ83ikf8b1zrEFshIT+gRu77G/tUCsbY1ka39x+ygbmwIqQxR+R/ mGyg== X-Gm-Message-State: AOAM5320EAh9kesKEM2jAvWXvSrTSHbY8yRZPaSPp80BjbHg4AEGzgMy M9z7SNFSACj4wdQtag76MCJFCg== X-Received: by 2002:a1c:1bc7:: with SMTP id b190mr13478032wmb.115.1615558350171; Fri, 12 Mar 2021 06:12:30 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id k4sm10360878wrd.9.2021.03.12.06.12.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 06:12:29 -0800 (PST) Date: Fri, 12 Mar 2021 15:12:27 +0100 From: Daniel Vetter To: "Matthew Wilcox (Oracle)" Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, William Kucharski , Jani Nikula , Daniel Vetter , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ian Campbell , linux-fsdevel@vger.kernel.org, Jaya Kumar , Christoph Hellwig Subject: Re: [PATCH v2] fb_defio: Remove custom address_space_operations Message-ID: Mail-Followup-To: "Matthew Wilcox (Oracle)" , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, William Kucharski , Jani Nikula , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ian Campbell , linux-fsdevel@vger.kernel.org, Jaya Kumar , Christoph Hellwig References: <20210310185530.1053320-1-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210310185530.1053320-1-willy@infradead.org> X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 06:55:30PM +0000, Matthew Wilcox (Oracle) wrote: > There's no need to give the page an address_space. Leaving the > page->mapping as NULL will cause the VM to handle set_page_dirty() > the same way that it's handled now, and that was the only reason to > set the address_space in the first place. > > Signed-off-by: Matthew Wilcox (Oracle) > Reviewed-by: Christoph Hellwig > Reviewed-by: William Kucharski Thanks for your patch, merged to drm-misc-next for 5.13. While I have an expert here, does this mean that for a VM_PFNMAP we could pull of the same trick without any struct page backing, assuming we pulle the per-page dirty state into some tracking of our own? I'm asking since for DRM drivers we currently have a fairly awkward situation with a bounce buffer in system memory going on that we copy out of, because we can't directly use the gpu buffers. If we can track directly in the gpu buffers, maybe even as some kind of overlay over the vma, we could avoid that copy. Otoh no one cares about fbcon performance, so *shrug*. Cheers, Daniel > --- > v2: Delete local variable definitions > drivers/video/fbdev/core/fb_defio.c | 35 ----------------------------- > drivers/video/fbdev/core/fbmem.c | 4 ---- > include/linux/fb.h | 3 --- > 3 files changed, 42 deletions(-) > > diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c > index a591d291b231..b292887a2481 100644 > --- a/drivers/video/fbdev/core/fb_defio.c > +++ b/drivers/video/fbdev/core/fb_defio.c > @@ -52,13 +52,6 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf) > return VM_FAULT_SIGBUS; > > get_page(page); > - > - if (vmf->vma->vm_file) > - page->mapping = vmf->vma->vm_file->f_mapping; > - else > - printk(KERN_ERR "no mapping available\n"); > - > - BUG_ON(!page->mapping); > page->index = vmf->pgoff; > > vmf->page = page; > @@ -151,17 +144,6 @@ static const struct vm_operations_struct fb_deferred_io_vm_ops = { > .page_mkwrite = fb_deferred_io_mkwrite, > }; > > -static int fb_deferred_io_set_page_dirty(struct page *page) > -{ > - if (!PageDirty(page)) > - SetPageDirty(page); > - return 0; > -} > - > -static const struct address_space_operations fb_deferred_io_aops = { > - .set_page_dirty = fb_deferred_io_set_page_dirty, > -}; > - > int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma) > { > vma->vm_ops = &fb_deferred_io_vm_ops; > @@ -212,29 +194,12 @@ void fb_deferred_io_init(struct fb_info *info) > } > EXPORT_SYMBOL_GPL(fb_deferred_io_init); > > -void fb_deferred_io_open(struct fb_info *info, > - struct inode *inode, > - struct file *file) > -{ > - file->f_mapping->a_ops = &fb_deferred_io_aops; > -} > -EXPORT_SYMBOL_GPL(fb_deferred_io_open); > - > void fb_deferred_io_cleanup(struct fb_info *info) > { > struct fb_deferred_io *fbdefio = info->fbdefio; > - struct page *page; > - int i; > > BUG_ON(!fbdefio); > cancel_delayed_work_sync(&info->deferred_work); > - > - /* clear out the mapping that we setup */ > - for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { > - page = fb_deferred_io_page(info, i); > - page->mapping = NULL; > - } > - > mutex_destroy(&fbdefio->lock); > } > EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup); > diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c > index 06f5805de2de..372b52a2befa 100644 > --- a/drivers/video/fbdev/core/fbmem.c > +++ b/drivers/video/fbdev/core/fbmem.c > @@ -1415,10 +1415,6 @@ __releases(&info->lock) > if (res) > module_put(info->fbops->owner); > } > -#ifdef CONFIG_FB_DEFERRED_IO > - if (info->fbdefio) > - fb_deferred_io_open(info, inode, file); > -#endif > out: > unlock_fb_info(info); > if (res) > diff --git a/include/linux/fb.h b/include/linux/fb.h > index ecfbcc0553a5..a8dccd23c249 100644 > --- a/include/linux/fb.h > +++ b/include/linux/fb.h > @@ -659,9 +659,6 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, > /* drivers/video/fb_defio.c */ > int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma); > extern void fb_deferred_io_init(struct fb_info *info); > -extern void fb_deferred_io_open(struct fb_info *info, > - struct inode *inode, > - struct file *file); > extern void fb_deferred_io_cleanup(struct fb_info *info); > extern int fb_deferred_io_fsync(struct file *file, loff_t start, > loff_t end, int datasync); > -- > 2.30.0 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch