From: Sam Ravnborg <sam@ravnborg.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: javierm@redhat.com, daniel@ffwll.ch, deller@gmx.de,
airlied@linux.ie, maarten.lankhorst@linux.intel.com,
linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/3] fbdev: Track deferred-I/O pages in pageref struct
Date: Tue, 26 Apr 2022 11:24:08 +0200 [thread overview]
Message-ID: <Yme6ON/t6Vxawo2B@ravnborg.org> (raw)
In-Reply-To: <cd5a70a8-0b35-66b6-5168-e5895c1ed3df@suse.de>
Hi Thomas,
> > > +
> > > /* this is to find and return the vmalloc-ed fb pages */
> > > static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf)
> > > {
> > > @@ -59,7 +113,7 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf)
> > > printk(KERN_ERR "no mapping available\n");
> > > BUG_ON(!page->mapping);
> > > - page->index = vmf->pgoff;
> > > + page->index = vmf->pgoff; /* for page_mkclean() */
> > > vmf->page = page;
> > > return 0;
> > > @@ -95,7 +149,11 @@ static vm_fault_t fb_deferred_io_mkwrite(struct vm_fault *vmf)
> > > struct page *page = vmf->page;
> > > struct fb_info *info = vmf->vma->vm_private_data;
> > > struct fb_deferred_io *fbdefio = info->fbdefio;
> > > - struct list_head *pos = &fbdefio->pagelist;
> > > + struct fb_deferred_io_pageref *pageref;
> > > + unsigned long offset;
> > > + vm_fault_t ret;
> > > +
> > > + offset = (vmf->address - vmf->vma->vm_start);
> > > /* this is a callback we get when userspace first tries to
> > > write to the page. we schedule a workqueue. that workqueue
> > > @@ -112,6 +170,12 @@ static vm_fault_t fb_deferred_io_mkwrite(struct vm_fault *vmf)
> > > if (fbdefio->first_io && list_empty(&fbdefio->pagelist))
> > > fbdefio->first_io(info);
> > > + pageref = fb_deferred_io_pageref_get(info, offset, page);
> > Compared to the old code we now do all the sorting and stuff without
> > the page locked, which seem like a big change.
>
> We never touch any of the page's fields in fb_deferred_io_pageref_get().
> It's only used to initialize the pageref's page pointer. The pagerefs are
> all protected by fbdev-internal locking. Is there a reason why we should
> further hold the page lock?
I only commented because it was a change in scope of the lock, I did not
see anything wrong in the locking, but then I do not understand locking
so that does not say much.
>
> All sorting is done by the pageref addresses, which implicitly correspond to
> 'offset'. After looking at the new function again, I'll change it to sort
> directly by offset. It's clearer in its intend.
Looks forward for the re-spin.
Sam
next prev parent reply other threads:[~2022-04-26 10:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 11:27 [PATCH v2 0/3] fbdev: Decouple deferred I/O from struct page Thomas Zimmermann
2022-04-25 11:27 ` [PATCH v2 1/3] fbdev: Put mmap for deferred I/O into drivers Thomas Zimmermann
2022-04-25 15:53 ` kernel test robot
2022-04-25 17:26 ` Sam Ravnborg
2022-04-25 17:46 ` Sam Ravnborg
2022-04-26 7:39 ` Thomas Zimmermann
2022-04-25 11:27 ` [PATCH v2 2/3] fbdev: Track deferred-I/O pages in pageref struct Thomas Zimmermann
2022-04-25 18:17 ` Sam Ravnborg
2022-04-26 8:01 ` Thomas Zimmermann
2022-04-26 9:24 ` Sam Ravnborg [this message]
2022-04-25 11:27 ` [PATCH v2 3/3] fbdev: Refactor implementation of page_mkwrite Thomas Zimmermann
2022-04-25 18:24 ` Sam Ravnborg
2022-04-26 8:10 ` Thomas Zimmermann
2022-04-26 8:41 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yme6ON/t6Vxawo2B@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).