Commit c0f5ac5426f7fd82b23dd5c6a1e633b290294a08
Committed by
Jesse Barnes
1 parent
6db45b76ea
Exists in
master
and in
4 other branches
Revert "resources: support allocating space within a region from the top down"
This reverts commit e7f8567db9a7f6b3151b0b275e245c1cef0d9c70. Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Showing 3 changed files with 4 additions and 100 deletions Side-by-side Diff
Documentation/kernel-parameters.txt
... | ... | @@ -2175,11 +2175,6 @@ |
2175 | 2175 | reset_devices [KNL] Force drivers to reset the underlying device |
2176 | 2176 | during initialization. |
2177 | 2177 | |
2178 | - resource_alloc_from_bottom | |
2179 | - Allocate new resources from the beginning of available | |
2180 | - space, not the end. If you need to use this, please | |
2181 | - report a bug. | |
2182 | - | |
2183 | 2178 | resume= [SWSUSP] |
2184 | 2179 | Specify the partition device for software suspend |
2185 | 2180 |
include/linux/ioport.h
... | ... | @@ -112,7 +112,6 @@ |
112 | 112 | /* PC/ISA/whatever - the normal PC address spaces: IO and memory */ |
113 | 113 | extern struct resource ioport_resource; |
114 | 114 | extern struct resource iomem_resource; |
115 | -extern int resource_alloc_from_bottom; | |
116 | 115 | |
117 | 116 | extern struct resource *request_resource_conflict(struct resource *root, struct resource *new); |
118 | 117 | extern int request_resource(struct resource *root, struct resource *new); |
kernel/resource.c
... | ... | @@ -40,23 +40,6 @@ |
40 | 40 | |
41 | 41 | static DEFINE_RWLOCK(resource_lock); |
42 | 42 | |
43 | -/* | |
44 | - * By default, we allocate free space bottom-up. The architecture can request | |
45 | - * top-down by clearing this flag. The user can override the architecture's | |
46 | - * choice with the "resource_alloc_from_bottom" kernel boot option, but that | |
47 | - * should only be a debugging tool. | |
48 | - */ | |
49 | -int resource_alloc_from_bottom = 1; | |
50 | - | |
51 | -static __init int setup_alloc_from_bottom(char *s) | |
52 | -{ | |
53 | - printk(KERN_INFO | |
54 | - "resource: allocating from bottom-up; please report a bug\n"); | |
55 | - resource_alloc_from_bottom = 1; | |
56 | - return 0; | |
57 | -} | |
58 | -early_param("resource_alloc_from_bottom", setup_alloc_from_bottom); | |
59 | - | |
60 | 43 | static void *r_next(struct seq_file *m, void *v, loff_t *pos) |
61 | 44 | { |
62 | 45 | struct resource *p = v; |
63 | 46 | |
64 | 47 | |
... | ... | @@ -397,75 +380,8 @@ |
397 | 380 | } |
398 | 381 | |
399 | 382 | /* |
400 | - * Find the resource before "child" in the sibling list of "root" children. | |
401 | - */ | |
402 | -static struct resource *find_sibling_prev(struct resource *root, struct resource *child) | |
403 | -{ | |
404 | - struct resource *this; | |
405 | - | |
406 | - for (this = root->child; this; this = this->sibling) | |
407 | - if (this->sibling == child) | |
408 | - return this; | |
409 | - | |
410 | - return NULL; | |
411 | -} | |
412 | - | |
413 | -/* | |
414 | 383 | * Find empty slot in the resource tree given range and alignment. |
415 | - * This version allocates from the end of the root resource first. | |
416 | 384 | */ |
417 | -static int find_resource_from_top(struct resource *root, struct resource *new, | |
418 | - resource_size_t size, resource_size_t min, | |
419 | - resource_size_t max, resource_size_t align, | |
420 | - resource_size_t (*alignf)(void *, | |
421 | - const struct resource *, | |
422 | - resource_size_t, | |
423 | - resource_size_t), | |
424 | - void *alignf_data) | |
425 | -{ | |
426 | - struct resource *this; | |
427 | - struct resource tmp, avail, alloc; | |
428 | - | |
429 | - tmp.start = root->end; | |
430 | - tmp.end = root->end; | |
431 | - | |
432 | - this = find_sibling_prev(root, NULL); | |
433 | - for (;;) { | |
434 | - if (this) { | |
435 | - if (this->end < root->end) | |
436 | - tmp.start = this->end + 1; | |
437 | - } else | |
438 | - tmp.start = root->start; | |
439 | - | |
440 | - resource_clip(&tmp, min, max); | |
441 | - | |
442 | - /* Check for overflow after ALIGN() */ | |
443 | - avail = *new; | |
444 | - avail.start = ALIGN(tmp.start, align); | |
445 | - avail.end = tmp.end; | |
446 | - if (avail.start >= tmp.start) { | |
447 | - alloc.start = alignf(alignf_data, &avail, size, align); | |
448 | - alloc.end = alloc.start + size - 1; | |
449 | - if (resource_contains(&avail, &alloc)) { | |
450 | - new->start = alloc.start; | |
451 | - new->end = alloc.end; | |
452 | - return 0; | |
453 | - } | |
454 | - } | |
455 | - | |
456 | - if (!this || this->start == root->start) | |
457 | - break; | |
458 | - | |
459 | - tmp.end = this->start - 1; | |
460 | - this = find_sibling_prev(root, this); | |
461 | - } | |
462 | - return -EBUSY; | |
463 | -} | |
464 | - | |
465 | -/* | |
466 | - * Find empty slot in the resource tree given range and alignment. | |
467 | - * This version allocates from the beginning of the root resource first. | |
468 | - */ | |
469 | 385 | static int find_resource(struct resource *root, struct resource *new, |
470 | 386 | resource_size_t size, resource_size_t min, |
471 | 387 | resource_size_t max, resource_size_t align, |
472 | 388 | |
... | ... | @@ -480,15 +396,14 @@ |
480 | 396 | |
481 | 397 | tmp.start = root->start; |
482 | 398 | /* |
483 | - * Skip past an allocated resource that starts at 0, since the | |
484 | - * assignment of this->start - 1 to tmp->end below would cause an | |
485 | - * underflow. | |
399 | + * Skip past an allocated resource that starts at 0, since the assignment | |
400 | + * of this->start - 1 to tmp->end below would cause an underflow. | |
486 | 401 | */ |
487 | 402 | if (this && this->start == 0) { |
488 | 403 | tmp.start = this->end + 1; |
489 | 404 | this = this->sibling; |
490 | 405 | } |
491 | - for (;;) { | |
406 | + for(;;) { | |
492 | 407 | if (this) |
493 | 408 | tmp.end = this->start - 1; |
494 | 409 | else |
495 | 410 | |
... | ... | @@ -509,10 +424,8 @@ |
509 | 424 | return 0; |
510 | 425 | } |
511 | 426 | } |
512 | - | |
513 | 427 | if (!this) |
514 | 428 | break; |
515 | - | |
516 | 429 | tmp.start = this->end + 1; |
517 | 430 | this = this->sibling; |
518 | 431 | } |
... | ... | @@ -545,10 +458,7 @@ |
545 | 458 | alignf = simple_align_resource; |
546 | 459 | |
547 | 460 | write_lock(&resource_lock); |
548 | - if (resource_alloc_from_bottom) | |
549 | - err = find_resource(root, new, size, min, max, align, alignf, alignf_data); | |
550 | - else | |
551 | - err = find_resource_from_top(root, new, size, min, max, align, alignf, alignf_data); | |
461 | + err = find_resource(root, new, size, min, max, align, alignf, alignf_data); | |
552 | 462 | if (err >= 0 && __request_resource(root, new)) |
553 | 463 | err = -EBUSY; |
554 | 464 | write_unlock(&resource_lock); |