diff options
| -rw-r--r-- | mm/slub.c | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -1844,6 +1844,7 @@ static inline int calculate_order(int size) | |||
| 1844 | int order; | 1844 | int order; |
| 1845 | int min_objects; | 1845 | int min_objects; |
| 1846 | int fraction; | 1846 | int fraction; |
| 1847 | int max_objects; | ||
| 1847 | 1848 | ||
| 1848 | /* | 1849 | /* |
| 1849 | * Attempt to find best configuration for a slab. This | 1850 | * Attempt to find best configuration for a slab. This |
| @@ -1856,6 +1857,9 @@ static inline int calculate_order(int size) | |||
| 1856 | min_objects = slub_min_objects; | 1857 | min_objects = slub_min_objects; |
| 1857 | if (!min_objects) | 1858 | if (!min_objects) |
| 1858 | min_objects = 4 * (fls(nr_cpu_ids) + 1); | 1859 | min_objects = 4 * (fls(nr_cpu_ids) + 1); |
| 1860 | max_objects = (PAGE_SIZE << slub_max_order)/size; | ||
| 1861 | min_objects = min(min_objects, max_objects); | ||
| 1862 | |||
| 1859 | while (min_objects > 1) { | 1863 | while (min_objects > 1) { |
| 1860 | fraction = 16; | 1864 | fraction = 16; |
| 1861 | while (fraction >= 4) { | 1865 | while (fraction >= 4) { |
| @@ -1865,7 +1869,7 @@ static inline int calculate_order(int size) | |||
| 1865 | return order; | 1869 | return order; |
| 1866 | fraction /= 2; | 1870 | fraction /= 2; |
| 1867 | } | 1871 | } |
| 1868 | min_objects /= 2; | 1872 | min_objects --; |
| 1869 | } | 1873 | } |
| 1870 | 1874 | ||
| 1871 | /* | 1875 | /* |
