Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98858
b: refs/heads/master
c: f31ad92
h: refs/heads/master
v: v3
  • Loading branch information
Jaya Kumar authored and Linus Torvalds committed Jul 12, 2008
1 parent b127c93 commit a2cd999
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4fc89e3911aa5357b55b85b60c4beaeb8a48a290
refs/heads/master: f31ad92f34913043cf008d6e479e92dfbaf02df1
20 changes: 19 additions & 1 deletion trunk/drivers/video/fb_defio.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
{
struct fb_info *info = vma->vm_private_data;
struct fb_deferred_io *fbdefio = info->fbdefio;
struct page *cur;

/* this is a callback we get when userspace first tries to
write to the page. we schedule a workqueue. that workqueue
Expand All @@ -83,7 +84,24 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,

/* protect against the workqueue changing the page list */
mutex_lock(&fbdefio->lock);
list_add(&page->lru, &fbdefio->pagelist);

/* we loop through the pagelist before adding in order
to keep the pagelist sorted */
list_for_each_entry(cur, &fbdefio->pagelist, lru) {
/* this check is to catch the case where a new
process could start writing to the same page
through a new pte. this new access can cause the
mkwrite even when the original ps's pte is marked
writable */
if (unlikely(cur == page))
goto page_already_added;
else if (cur->index > page->index)
break;
}

list_add_tail(&page->lru, &cur->lru);

page_already_added:
mutex_unlock(&fbdefio->lock);

/* come back after delay to process the deferred IO */
Expand Down

0 comments on commit a2cd999

Please sign in to comment.