fix alloc co_stack failed, and add resident_size for CHUNK_MGR
This commit is contained in:
		
							
								
								
									
										4
									
								
								deps/oblib/src/common/ob_smart_call.h
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								deps/oblib/src/common/ob_smart_call.h
									
									
									
									
										vendored
									
									
								
							@ -21,8 +21,8 @@ namespace oceanbase
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
namespace common
 | 
					namespace common
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
static constexpr int64_t ALL_STACK_LIMIT = 10L << 20;
 | 
					static constexpr int64_t ALL_STACK_LIMIT = 12L << 20;
 | 
				
			||||||
static constexpr int64_t STACK_PER_EXTEND = (2L << 20) - ACHUNK_PRESERVE_SIZE;
 | 
					static constexpr int64_t STACK_PER_EXTEND = (4L << 20) - ACHUNK_PRESERVE_SIZE;
 | 
				
			||||||
static constexpr int64_t STACK_RESERVED_SIZE = 128L << 10;
 | 
					static constexpr int64_t STACK_RESERVED_SIZE = 128L << 10;
 | 
				
			||||||
RLOCAL_EXTERN(int64_t, all_stack_size);
 | 
					RLOCAL_EXTERN(int64_t, all_stack_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,18 +20,6 @@
 | 
				
			|||||||
#include "observer/ob_server_struct.h"         // GCTX
 | 
					#include "observer/ob_server_struct.h"         // GCTX
 | 
				
			||||||
#include "share/ob_tenant_mgr.h"
 | 
					#include "share/ob_tenant_mgr.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int64_t get_virtual_memory_used()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  constexpr int BUFFER_SIZE = 128;
 | 
					 | 
				
			||||||
  char filename[BUFFER_SIZE];
 | 
					 | 
				
			||||||
  int64_t page_cnt = 0;
 | 
					 | 
				
			||||||
  snprintf(filename, BUFFER_SIZE, "/proc/%d/statm", getpid());
 | 
					 | 
				
			||||||
  FILE *statm = fopen(filename, "r");
 | 
					 | 
				
			||||||
  fscanf(statm, "%ld", &page_cnt);
 | 
					 | 
				
			||||||
  fclose(statm);
 | 
					 | 
				
			||||||
  return page_cnt * sysconf(_SC_PAGESIZE);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace oceanbase
 | 
					namespace oceanbase
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
namespace lib
 | 
					namespace lib
 | 
				
			||||||
 | 
				
			|||||||
@ -123,11 +123,12 @@ int ObTenantMemoryPrinter::print_tenant_usage()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // print global chunk freelist
 | 
					    // print global chunk freelist
 | 
				
			||||||
    int64_t memory_used = get_virtual_memory_used();
 | 
					    int64_t resident_size = 0;
 | 
				
			||||||
 | 
					    int64_t memory_used = get_virtual_memory_used(&resident_size);
 | 
				
			||||||
    _STORAGE_LOG(INFO,
 | 
					    _STORAGE_LOG(INFO,
 | 
				
			||||||
        "[CHUNK_MGR] free=%ld pushes=%ld pops=%ld limit=%'15ld hold=%'15ld total_hold=%'15ld used=%'15ld" \
 | 
					        "[CHUNK_MGR] free=%ld pushes=%ld pops=%ld limit=%'15ld hold=%'15ld total_hold=%'15ld used=%'15ld" \
 | 
				
			||||||
        " freelist_hold=%'15ld maps=%'15ld unmaps=%'15ld large_maps=%'15ld large_unmaps=%'15ld" \
 | 
					        " freelist_hold=%'15ld maps=%'15ld unmaps=%'15ld large_maps=%'15ld large_unmaps=%'15ld" \
 | 
				
			||||||
        " memalign=%d"
 | 
					        " memalign=%d resident_size=%'15ld"
 | 
				
			||||||
#ifndef ENABLE_SANITY
 | 
					#ifndef ENABLE_SANITY
 | 
				
			||||||
        " virtual_memory_used=%'15ld\n",
 | 
					        " virtual_memory_used=%'15ld\n",
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
@ -146,6 +147,7 @@ int ObTenantMemoryPrinter::print_tenant_usage()
 | 
				
			|||||||
        CHUNK_MGR.get_large_maps(),
 | 
					        CHUNK_MGR.get_large_maps(),
 | 
				
			||||||
        CHUNK_MGR.get_large_unmaps(),
 | 
					        CHUNK_MGR.get_large_unmaps(),
 | 
				
			||||||
        0,
 | 
					        0,
 | 
				
			||||||
 | 
					        resident_size,
 | 
				
			||||||
#ifndef ENABLE_SANITY
 | 
					#ifndef ENABLE_SANITY
 | 
				
			||||||
        memory_used
 | 
					        memory_used
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user