Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153851389
D15293.id43673.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15293.id43673.diff
View Options
Index: sys/vm/swap_pager.c
===================================================================
--- sys/vm/swap_pager.c
+++ sys/vm/swap_pager.c
@@ -1096,21 +1096,16 @@
int *rahead)
{
struct buf *bp;
+ vm_page_t bm, m;
vm_page_t mpred, msucc, p;
vm_pindex_t pindex;
daddr_t blk;
- int i, j, maxahead, maxbehind, reqcount, shift;
+ int i, maxahead, maxbehind, reqcount, shift;
reqcount = count;
- VM_OBJECT_WUNLOCK(object);
- bp = getpbuf(&nsw_rcount);
- VM_OBJECT_WLOCK(object);
-
- if (!swap_pager_haspage(object, ma[0]->pindex, &maxbehind, &maxahead)) {
- relpbuf(bp, &nsw_rcount);
+ if (!swap_pager_haspage(object, ma[0]->pindex, &maxbehind, &maxahead))
return (VM_PAGER_FAIL);
- }
/*
* Clip the readahead and readbehind ranges to exclude resident pages.
@@ -1135,32 +1130,24 @@
/*
* Allocate readahead and readbehind pages.
*/
- shift = rbehind != NULL ? *rbehind : 0;
- if (shift != 0) {
+ bm = ma[0];
+ if (rbehind != NULL) {
+ shift = *rbehind;
for (i = 1; i <= shift; i++) {
p = vm_page_alloc(object, ma[0]->pindex - i,
VM_ALLOC_NORMAL);
- if (p == NULL) {
- /* Shift allocated pages to the left. */
- for (j = 0; j < i - 1; j++)
- bp->b_pages[j] =
- bp->b_pages[j + shift - i + 1];
+ if (p == NULL)
break;
- }
- bp->b_pages[shift - i] = p;
+ bm = p;
}
- shift = i - 1;
- *rbehind = shift;
+ *rbehind = i - 1;
}
- for (i = 0; i < reqcount; i++)
- bp->b_pages[i + shift] = ma[i];
if (rahead != NULL) {
for (i = 0; i < *rahead; i++) {
p = vm_page_alloc(object,
ma[reqcount - 1]->pindex + i + 1, VM_ALLOC_NORMAL);
if (p == NULL)
break;
- bp->b_pages[shift + reqcount + i] = p;
}
*rahead = i;
}
@@ -1171,15 +1158,18 @@
vm_object_pip_add(object, count);
- for (i = 0; i < count; i++)
- bp->b_pages[i]->oflags |= VPO_SWAPINPROG;
+ for (i = 0, m = bm; i < count; i++, m = vm_page_next(m))
+ m->oflags |= VPO_SWAPINPROG;
- pindex = bp->b_pages[0]->pindex;
+ pindex = bm->pindex;
blk = swp_pager_meta_ctl(object, pindex, 0);
KASSERT(blk != SWAPBLK_NONE,
("no swap blocking containing %p(%jx)", object, (uintmax_t)pindex));
VM_OBJECT_WUNLOCK(object);
+ bp = getpbuf(&nsw_rcount);
+ for (i = 0, m = bm; i < count; i++, m = vm_page_next(m))
+ bp->b_pages[i] = m;
bp->b_flags |= B_PAGING;
bp->b_iocmd = BIO_READ;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 25, 6:23 AM (3 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32113766
Default Alt Text
D15293.id43673.diff (2 KB)
Attached To
Mode
D15293: Handle the race between fork/vm_object_split() and faults.
Attached
Detach File
Event Timeline
Log In to Comment