[OpenAFS-devel] afs_osi_Sleep and afs_osi_Wakeup on Linux
Derrick J Brashear
shadow@dementia.org
Fri, 7 Jun 2002 20:49:51 -0400 (EDT)
On Wed, 5 Jun 2002, chas williams wrote:
> the attached patch 'fixes', in my opinion, in osi_alloc. objects <=
> AFS_SMALLOCSIZ are alloced with kmalloc, other vmalloc. if kmalloc
> fails it doesnt fail over to vmalloc. TASK_RUNNING is set after
> schedule. it doesnt drop the GLOCK. i moved the allocator init
> later so that it doesnt need to toggle the semaphore just before
> going to linux_alloc.
but you have the "can call linux_alloc before linux_alloc_init" problem
now.
> @@ -287,21 +286,21 @@
> void *new = NULL;
> struct osi_linux_mem *lmem;
>
> + new = linux_alloc(asize); /* get a chunk of memory of size asize */
> +
> + if (!new) {
> + printf("afs_osi_Alloc: Can't vmalloc %d bytes.\n", asize);
> + return new;
> + }
> +
> down(&afs_linux_alloc_sem);
>
> - if (allocator_init == 0) { /* allocator hasn't been initialized yet */
> + /* allocator hasn't been initialized yet */
> + if (allocator_init == 0) {
> if (linux_alloc_init() == 0) {
> goto error;
> }
> allocator_init = 1; /* initialization complete */
> - }
> -
> - up(&afs_linux_alloc_sem);
> - new = linux_alloc(asize); /* get a chunk of memory of size asize */
> - down(&afs_linux_alloc_sem);
> - if (!new) {
> - printf("afs_osi_Alloc: Can't vmalloc %d bytes.\n", asize);
> - goto error;
> }