mirror of https://github.com/schoebel/mars
brick_mem: make CONFIG_MARS_MEM_RETRY mandatory by removing the symbol
This commit is contained in:
parent
b4e0927d20
commit
48a19e58d1
|
@ -134,13 +134,6 @@ config MARS_IPv4_TOS
|
||||||
In certain private networks, this can improve certain
|
In certain private networks, this can improve certain
|
||||||
network bottlenecks.
|
network bottlenecks.
|
||||||
|
|
||||||
config MARS_MEM_RETRY
|
|
||||||
bool "make MARS memory allocation more robust"
|
|
||||||
depends on MARS
|
|
||||||
default y
|
|
||||||
---help---
|
|
||||||
Normally ON. Switch only off for systems having very low memory.
|
|
||||||
|
|
||||||
config MARS_LOGDIR
|
config MARS_LOGDIR
|
||||||
string "absolute path to the logging directory"
|
string "absolute path to the logging directory"
|
||||||
depends on MARS
|
depends on MARS
|
||||||
|
|
|
@ -125,7 +125,6 @@ void *__brick_mem_alloc(int len)
|
||||||
#endif
|
#endif
|
||||||
res = _brick_block_alloc(0, len, 0);
|
res = _brick_block_alloc(0, len, 0);
|
||||||
} else {
|
} else {
|
||||||
#ifdef CONFIG_MARS_MEM_RETRY
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
res = kmalloc(len, GFP_BRICK);
|
res = kmalloc(len, GFP_BRICK);
|
||||||
if (likely(res))
|
if (likely(res))
|
||||||
|
@ -134,13 +133,6 @@ void *__brick_mem_alloc(int len)
|
||||||
}
|
}
|
||||||
#ifdef BRICK_DEBUG_MEM
|
#ifdef BRICK_DEBUG_MEM
|
||||||
atomic_inc(&phys_mem_alloc);
|
atomic_inc(&phys_mem_alloc);
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
res = kmalloc(len, GFP_BRICK);
|
|
||||||
#ifdef BRICK_DEBUG_MEM
|
|
||||||
if (res)
|
|
||||||
atomic_inc(&phys_mem_alloc);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -286,16 +278,12 @@ char *_brick_string_alloc(int len, int line)
|
||||||
len = BRICK_STRING_LEN;
|
len = BRICK_STRING_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MARS_MEM_RETRY
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#endif
|
|
||||||
res = kzalloc(len + STRING_PLUS, GFP_BRICK);
|
res = kzalloc(len + STRING_PLUS, GFP_BRICK);
|
||||||
#ifdef CONFIG_MARS_MEM_RETRY
|
|
||||||
if (likely(res))
|
if (likely(res))
|
||||||
break;
|
break;
|
||||||
msleep(1000);
|
msleep(1000);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BRICK_DEBUG_MEM
|
#ifdef BRICK_DEBUG_MEM
|
||||||
if (likely(res)) {
|
if (likely(res)) {
|
||||||
|
@ -498,20 +486,16 @@ static inline
|
||||||
void *__brick_block_alloc(gfp_t gfp, int order, int cline)
|
void *__brick_block_alloc(gfp_t gfp, int order, int cline)
|
||||||
{
|
{
|
||||||
void *res;
|
void *res;
|
||||||
#ifdef CONFIG_MARS_MEM_RETRY
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#endif
|
|
||||||
#ifdef USE_KERNEL_PAGES
|
#ifdef USE_KERNEL_PAGES
|
||||||
res = (void*)__get_free_pages(gfp, order);
|
res = (void*)__get_free_pages(gfp, order);
|
||||||
#else
|
#else
|
||||||
res = __vmalloc(PAGE_SIZE << order, gfp, PAGE_KERNEL_IO);
|
res = __vmalloc(PAGE_SIZE << order, gfp, PAGE_KERNEL_IO);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_MARS_MEM_RETRY
|
|
||||||
if (likely(res))
|
if (likely(res))
|
||||||
break;
|
break;
|
||||||
msleep(1000);
|
msleep(1000);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (likely(res)) {
|
if (likely(res)) {
|
||||||
#ifdef CONFIG_MARS_DEBUG_MEM_STRONG
|
#ifdef CONFIG_MARS_DEBUG_MEM_STRONG
|
||||||
|
|
|
@ -96,18 +96,14 @@ void *__mark_ptr_nonnull(void *_ptr)
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All the brick memory allocations are guaranteed to succeed when
|
/* All the brick memory allocations need to succeed.
|
||||||
* CONFIG_MARS_MEM_RETRY is set. In case of low memory, they will just
|
* In case of low memory, they will retry (forever),
|
||||||
* retry (forever).
|
* but only after some pause.
|
||||||
*
|
*
|
||||||
* Allow checking code to be written which works for both cases:
|
* This allows OOM to catch in, and to (hopefully)
|
||||||
* CONFIG_MARS_MEM_RETRY is selected, or not.
|
* improve the situation.
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_MARS_MEM_RETRY
|
|
||||||
#define brick_mark_nonnull __mark_ptr_nonnull
|
#define brick_mark_nonnull __mark_ptr_nonnull
|
||||||
#else
|
|
||||||
#define brick_mark_nonnull(p) (p)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue