See reply below. thanks,
Anders Widell On 04/07/2017 05:17 AM, A V Mahesh wrote: > Hi Anders Widell, > > Ack with following comments : > > On 4/6/2017 4:55 PM, Anders Widell wrote: >> The setting OSAF_CKPT_SHM_ALLOC_GUARANTEE=0 results in increased >> memory usage, >> whereas the setting OSAF_CKPT_SHM_ALLOC_GUARANTEE=1 results in lower >> performance. Thus, there was no way to configure CKPT to avoid a >> characteristics >> regression. > Change the commit comment to other way : > > OSAF_CKPT_SHM_ALLOC_GUARANTEE=1 results in increased memory usage > OSAF_CKPT_SHM_ALLOC_GUARANTEE=0 results in lower performance > > Change the following in /etc/opensaf/ckptnd.conf : > > - Add comment `The Default configuration is > OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 (Neither per-allocated nor check if > memory is available) > and in this configuration it is responsibility of application to > make sure the required SHM if application is using high memory usage. ` > > - Change #OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 (default) to > #OSAF_CKPT_SHM_ALLOC_GUARANTEE=0 Anders W> I would prefer to keep OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 to show the default setting. > > -AVM > > > On 4/6/2017 4:55 PM, Anders Widell wrote: >> src/ckpt/ckptnd/ckptnd.conf | 6 ++++++ >> src/ckpt/ckptnd/cpnd_cb.h | 3 ++- >> src/ckpt/ckptnd/cpnd_init.c | 3 ++- >> src/ckpt/ckptnd/cpnd_proc.c | 9 +++++---- >> src/ckpt/ckptnd/cpnd_res.c | 9 +++++---- >> 5 files changed, 20 insertions(+), 10 deletions(-) >> >> >> The setting OSAF_CKPT_SHM_ALLOC_GUARANTEE=0 results in increased >> memory usage, >> whereas the setting OSAF_CKPT_SHM_ALLOC_GUARANTEE=1 results in lower >> performance. Thus, there was no way to configure CKPT to avoid a >> characteristics >> regression. >> >> Fix this by adding a third option: OSAF_CKPT_SHM_ALLOC_GUARANTEE=2. >> This setting >> will be the default, and result in no degradation of performance or >> memory >> usage. >> >> diff --git a/src/ckpt/ckptnd/ckptnd.conf b/src/ckpt/ckptnd/ckptnd.conf >> --- a/src/ckpt/ckptnd/ckptnd.conf >> +++ b/src/ckpt/ckptnd/ckptnd.conf >> @@ -7,5 +7,11 @@ >> # Healthcheck keys >> export CPSV_ENV_HEALTHCHECK_KEY="Default" >> +# Controls how shared memory is allocated: >> +# 0 - No pre-allocation, but check if memory is available before >> writing >> +# 1 - Pre allocated >> +# 2 - Neither pre-allocated nor check if memory is available >> +#export OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 >> + >> # Uncomment the next line to enable info level logging >> #args="--loglevel=info" >> diff --git a/src/ckpt/ckptnd/cpnd_cb.h b/src/ckpt/ckptnd/cpnd_cb.h >> --- a/src/ckpt/ckptnd/cpnd_cb.h >> +++ b/src/ckpt/ckptnd/cpnd_cb.h >> @@ -1,6 +1,7 @@ >> /* -*- OpenSAF -*- >> * >> * (C) Copyright 2008 The OpenSAF Foundation >> + * Copyright Ericsson AB 2017 - All Rights Reserved. >> * >> * This program is distributed in the hope that it will be useful, but >> * WITHOUT ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY >> @@ -322,7 +323,7 @@ typedef struct cpnd_cb_tag { >> NCS_QUEUE cpnd_cpd_deferred_reqs_list; /* Queue for storing >> CPD timeout requests */ >> bool scAbsenceAllowed; >> - bool shm_alloc_guaranteed; >> + int shm_alloc_guaranteed; >> NCS_SEL_OBJ clm_updated_sel_obj; /* The CLM select object >> updated event */ >> diff --git a/src/ckpt/ckptnd/cpnd_init.c b/src/ckpt/ckptnd/cpnd_init.c >> --- a/src/ckpt/ckptnd/cpnd_init.c >> +++ b/src/ckpt/ckptnd/cpnd_init.c >> @@ -1,6 +1,7 @@ >> /* -*- OpenSAF -*- >> * >> * (C) Copyright 2008 The OpenSAF Foundation >> + * Copyright Ericsson AB 2017 - All Rights Reserved. >> * >> * This program is distributed in the hope that it will be useful, but >> * WITHOUT ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY >> @@ -223,7 +224,7 @@ static uint32_t cpnd_lib_init(CPND_CREAT >> if ((ptr = getenv("OSAF_CKPT_SHM_ALLOC_GUARANTEE")) != NULL) { >> cb->shm_alloc_guaranteed = atoi(ptr); >> } else { >> - cb->shm_alloc_guaranteed = false; >> + cb->shm_alloc_guaranteed = 2; >> } >> /* create a mail box */ >> diff --git a/src/ckpt/ckptnd/cpnd_proc.c b/src/ckpt/ckptnd/cpnd_proc.c >> --- a/src/ckpt/ckptnd/cpnd_proc.c >> +++ b/src/ckpt/ckptnd/cpnd_proc.c >> @@ -1,6 +1,7 @@ >> /* -*- OpenSAF -*- >> * >> * (C) Copyright 2008 The OpenSAF Foundation >> + * Copyright Ericsson AB 2017 - All Rights Reserved. >> * >> * This program is distributed in the hope that it will be useful, but >> * WITHOUT ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY >> @@ -478,7 +479,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C >> cp_node->replica_info.open.info.open.i_size = >> sizeof(CPSV_CKPT_HDR) + cp_node->create_attrib.maxSections >> * (sizeof(CPSV_SECT_HDR) + >> cp_node->create_attrib.maxSectionSize); >> - cp_node->replica_info.open.ensures_space = >> cb->shm_alloc_guaranteed; >> + cp_node->replica_info.open.ensures_space = >> cb->shm_alloc_guaranteed == 1; >> cp_node->replica_info.open.info.open.i_offset = 0; >> cp_node->replica_info.open.info.open.i_name = buf; >> @@ -671,7 +672,7 @@ uint32_t cpnd_ckpt_sec_write(CPND_CB *cb >> write_req.info.write.i_offset = offset; >> write_req.info.write.i_write_size = size; >> - write_req.ensures_space = cb->shm_alloc_guaranteed; >> + write_req.ensures_space = cb->shm_alloc_guaranteed != 0; >> if (ncs_os_posix_shm(&write_req) == NCSCC_RC_FAILURE) { >> LOG_ER("shm write failed for cpnd_ckpt_sec_write"); >> return NCSCC_RC_FAILURE; >> @@ -1836,7 +1837,7 @@ uint32_t cpnd_ckpt_hdr_update(CPND_CB *c >> write_req.info.write.i_from_buff = (CPSV_CKPT_HDR *)&ckpt_hdr; >> write_req.info.write.i_offset = 0; >> write_req.info.write.i_write_size = sizeof(CPSV_CKPT_HDR); >> - write_req.ensures_space = cb->shm_alloc_guaranteed; >> + write_req.ensures_space = cb->shm_alloc_guaranteed != 0; >> rc = ncs_os_posix_shm(&write_req); >> return rc; >> @@ -1879,7 +1880,7 @@ uint32_t cpnd_sec_hdr_update(CPND_CB *cb >> write_req.info.write.i_offset = >> sec_info->lcl_sec_id * (sizeof(CPSV_SECT_HDR) + >> cp_node->create_attrib.maxSectionSize); >> write_req.info.write.i_write_size = sizeof(CPSV_SECT_HDR); >> - write_req.ensures_space = cb->shm_alloc_guaranteed; >> + write_req.ensures_space = cb->shm_alloc_guaranteed != 0; >> rc = ncs_os_posix_shm(&write_req); >> return rc; >> diff --git a/src/ckpt/ckptnd/cpnd_res.c b/src/ckpt/ckptnd/cpnd_res.c >> --- a/src/ckpt/ckptnd/cpnd_res.c >> +++ b/src/ckpt/ckptnd/cpnd_res.c >> @@ -1,6 +1,7 @@ >> /* -*- OpenSAF -*- >> * >> * (C) Copyright 2008 The OpenSAF Foundation >> + * Copyright Ericsson AB 2017 - All Rights Reserved. >> * >> * This program is distributed in the hope that it will be useful, but >> * WITHOUT ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY >> @@ -170,7 +171,7 @@ uint32_t cpnd_ckpt_replica_create_res(CP >> open_req->info.open.i_map_flags = MAP_SHARED; >> open_req->info.open.o_addr = NULL; >> open_req->info.open.i_flags = O_RDWR; >> - open_req->ensures_space = cb->shm_alloc_guaranteed; >> + open_req->ensures_space = cb->shm_alloc_guaranteed == 1; >> rc = ncs_os_posix_shm(open_req); >> if (rc != NCSCC_RC_SUCCESS) { >> LOG_ER("cpnd shm open request failed %s",buf); >> @@ -359,7 +360,7 @@ void *cpnd_restart_shm_create(NCS_OS_POS >> cpnd_open_req->info.open.i_size = sizeof(CPND_SHM_VERSION) + >> sizeof(CLIENT_HDR) + (MAX_CLIENTS * sizeof(CLIENT_INFO)) + >> sizeof(CKPT_HDR) + >> (MAX_CKPTS * sizeof(CKPT_INFO)); >> - cpnd_open_req->ensures_space = cb->shm_alloc_guaranteed; >> + cpnd_open_req->ensures_space = cb->shm_alloc_guaranteed == 1; >> cpnd_open_req->info.open.i_offset = 0; >> cpnd_open_req->info.open.i_name = buffer; >> cpnd_open_req->info.open.i_map_flags = MAP_SHARED; >> @@ -1164,7 +1165,7 @@ uint32_t cpnd_restart_client_node_del(CP >> } >> clinfo_write.info.write.i_offset = cl_node->offset * >> sizeof(CLIENT_INFO); >> clinfo_write.info.write.i_write_size = sizeof(CLIENT_INFO); >> - clinfo_write.ensures_space = cb->shm_alloc_guaranteed; >> + clinfo_write.ensures_space = cb->shm_alloc_guaranteed != 0; >> rc = ncs_os_posix_shm(&clinfo_write); >> if (rc != NCSCC_RC_SUCCESS) { >> LOG_ER("cpnd ckpt info write failed"); >> @@ -1577,7 +1578,7 @@ static uint32_t cpnd_shm_extended_open(C >> cpnd_open_req.type = NCS_OS_POSIX_SHM_REQ_OPEN; >> cpnd_open_req.info.open.i_size = MAX_CKPTS * >> sizeof(CKPT_EXTENDED_INFO); >> - cpnd_open_req.ensures_space = cb->shm_alloc_guaranteed; >> + cpnd_open_req.ensures_space = cb->shm_alloc_guaranteed == 1; >> cpnd_open_req.info.open.i_offset = 0; >> cpnd_open_req.info.open.i_name = buffer; >> cpnd_open_req.info.open.i_map_flags = MAP_SHARED; > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel