Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F161157669
D23222.id66881.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23222.id66881.diff
View Options
Index: sys/vm/swap_pager.c
===================================================================
--- sys/vm/swap_pager.c
+++ sys/vm/swap_pager.c
@@ -424,6 +424,11 @@
static int swapoff_one(struct swdevt *sp, struct ucred *cred);
/*
+ * Swap swblk functions
+ */
+static bool swp_swblk_available(struct swdevt *sp, int npages);
+
+/*
* Swap bitmap functions
*/
static void swp_pager_freeswapspace(daddr_t blk, daddr_t npages);
@@ -734,6 +739,16 @@
object->type = OBJT_DEAD;
}
+static bool
+swp_swblk_available(struct swdevt *sp, int npages)
+{
+
+ if (sp->sw_flags & SW_CLOSING)
+ return (false);
+ return (sp->sw_nblks - howmany(BBSIZE, PAGE_SIZE) - sp->sw_used >=
+ npages );
+}
+
/************************************************************************
* SWAP PAGER BITMAP ROUTINES *
************************************************************************/
@@ -768,7 +783,7 @@
while (!TAILQ_EMPTY(&swtailq)) {
if (sp == NULL)
sp = TAILQ_FIRST(&swtailq);
- if ((sp->sw_flags & SW_CLOSING) == 0)
+ if (swp_swblk_available(sp, npages))
blk = blist_alloc(sp->sw_blist, &npages, mpages);
if (blk != SWAPBLK_NONE)
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 2, 2:13 AM (16 h, 18 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34543303
Default Alt Text
D23222.id66881.diff (1 KB)
Attached To
Mode
D23222: Check swblk size if a swap device has enoush space before calling blist_alloc
Attached
Detach File
Event Timeline
Log In to Comment