[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 04/64: Fix mach-defpager's kalloc values
From: |
Samuel Thibault |
Subject: |
[hurd] 04/64: Fix mach-defpager's kalloc values |
Date: |
Wed, 10 Dec 2014 15:17:03 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit cfafc1a905f11da2b856aecea02b8c7e1f95e5dd
Author: Samuel Thibault <address@hidden>
Date: Mon Nov 10 03:32:19 2014 +0100
Fix mach-defpager's kalloc values
* mach-defpager/kalloc.c (MINSIZE): Set to sizeof(vm_offset_t) instead
of hardcoded 4.
(kalloc_init): Set kalloc_max to MINSIZE << (KLIST_MAX-1) instead of
hardcoded 16384.
(kalloc, kfree): Use the cache for the maximum size too.
---
mach-defpager/kalloc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c
index 2f8f002..ef844ac 100644
--- a/mach-defpager/kalloc.c
+++ b/mach-defpager/kalloc.c
@@ -58,7 +58,7 @@ void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook)
(void) = init_hook;
* next highest power of 2.
*/
vm_size_t kalloc_max; /* max before we use vm_allocate */
-#define MINSIZE 4 /* minimum allocation size */
+#define MINSIZE sizeof(vm_offset_t) /* minimum
allocation size */
struct free_list {
pthread_spinlock_t lock;
@@ -99,8 +99,8 @@ void kalloc_init(void)
* 16Kbytes, whichever is less.
*/
- if (vm_page_size > 16*1024)
- kalloc_max = 16*1024;
+ if (vm_page_size > (MINSIZE << (KLIST_MAX-1)))
+ kalloc_max = (MINSIZE << (KLIST_MAX-1));
else
kalloc_max = vm_page_size;
@@ -197,7 +197,7 @@ void *kalloc(vm_size_t size)
/* compute the size of the block that we will actually allocate */
allocsize = size;
- if (size < kalloc_max) {
+ if (size <= kalloc_max) {
allocsize = MINSIZE;
fl = kfree_list;
while (allocsize < size) {
@@ -211,7 +211,7 @@ void *kalloc(vm_size_t size)
* and allocate.
*/
- if (allocsize < kalloc_max) {
+ if (allocsize <= kalloc_max) {
pthread_spin_lock(&fl->lock);
if ((addr = fl->head) != 0) {
fl->head = *(vm_offset_t *)addr;
@@ -241,7 +241,7 @@ kfree( void *data,
struct free_list *fl;
freesize = size;
- if (size < kalloc_max) {
+ if (size <= kalloc_max) {
freesize = MINSIZE;
fl = kfree_list;
while (freesize < size) {
@@ -250,7 +250,7 @@ kfree( void *data,
}
}
- if (freesize < kalloc_max) {
+ if (freesize <= kalloc_max) {
pthread_spin_lock(&fl->lock);
*(vm_offset_t *)data = fl->head;
fl->head = (vm_offset_t) data;
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 44/64: auth: add a payload-aware intrans function, (continued)
- [hurd] 44/64: auth: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 45/64: console: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 30/64: libpager: make the request queue more memory-efficient, Samuel Thibault, 2014/12/10
- [hurd] 63/64: fakeroot: Fix initializing default faked field of nodes, Samuel Thibault, 2014/12/10
- [hurd] 60/64: hurd: add intranpayload functions to all hurd types, Samuel Thibault, 2014/12/10
- [hurd] 33/64: Add atomicity support to fshelp_acquire_lock, Samuel Thibault, 2014/12/10
- [hurd] 59/64: utils/rpctrace: make `trace_and_forward' payload-aware, Samuel Thibault, 2014/12/10
- [hurd] 53/64: term: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 57/64: trans/streamio: make the translator payload-aware, Samuel Thibault, 2014/12/10
- [hurd] 64/64: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2014/12/10
- [hurd] 04/64: Fix mach-defpager's kalloc values,
Samuel Thibault <=
- [hurd] 06/64: utils/rpctrace: fix crash while printing messages, Samuel Thibault, 2014/12/10
- [hurd] 03/64: Avoid hitting VM_MAX_ADDRESS, Samuel Thibault, 2014/12/10
- [hurd] 05/64: Make procfs appear in /proc/mounts, Samuel Thibault, 2014/12/10
- [hurd] 08/64: Fix recording complete path of passive relative translators, Samuel Thibault, 2014/12/10
- [hurd] 07/64: Let pty readers always read end of writer output, Samuel Thibault, 2014/12/10
- [hurd] 54/64: trans/fakeroot: make the demuxer payload-aware, Samuel Thibault, 2014/12/10
- [hurd] 01/64: Deal with odd kernel behavior, Samuel Thibault, 2014/12/10
- [hurd] 02/64: Deal with odd kernel behavior, Samuel Thibault, 2014/12/10