FreeBSD Bugzilla – Attachment 246718 Details for
Bug 275436
tmpfs does not honor memory limits on writes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
another approach to patching tmpfs_subr.c
tmpfs_subr.c.patch (text/plain), 1.19 KB, created by
Mike Karels
on 2023-12-01 23:10:40 UTC
(
hide
)
Description:
another approach to patching tmpfs_subr.c
Filename:
MIME Type:
Creator:
Mike Karels
Created:
2023-12-01 23:10:40 UTC
Size:
1.19 KB
patch
obsolete
>diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c >index 2fe7f7e3ca58..e83a7d833376 100644 >--- a/sys/fs/tmpfs/tmpfs_subr.c >+++ b/sys/fs/tmpfs/tmpfs_subr.c >@@ -290,6 +290,8 @@ tmpfs_can_alloc_page(vm_object_t obj, vm_pindex_t pindex) > if (tm == NULL || vm_pager_has_page(obj, pindex, NULL, NULL) || > tm->tm_pages_max == 0) > return (true); >+ if (tm->tm_pages_max == ULONG_MAX) >+ return (tmpfs_mem_avail() >= 1); > return (tm->tm_pages_max > atomic_load_long(&tm->tm_pages_used)); > } > >@@ -413,7 +415,8 @@ tmpfs_mem_avail(void) > size_t avail; > long reserved; > >- avail = swap_pager_avail + vm_free_count(); >+ avail = swap_pager_avail / 2 + vm_free_avail(); >+ //avail = swap_pager_avail + vm_free_count(); > reserved = atomic_load_long(&tmpfs_pages_reserved); > if (__predict_false(avail < reserved)) > return (0); >@@ -1862,6 +1865,14 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, boolean_t ignerr) > if (newpages < oldpages) > vm_object_page_remove(uobj, newpages, 0, 0); > } >+#if 0 >+ if (newpages > oldpages) { >+ if (tmpfs_mem_avail() < newpages - oldpages) { >+ VM_OBJECT_WUNLOCK(uobj); >+ return (ENOSPC); >+ } >+ } >+#endif > uobj->size = newpages; > VM_OBJECT_WUNLOCK(uobj); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 275436
:
246673
|
246718
|
246880