Re: [devel] [PATCH 1 of 1] ckpt: Add option OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 for backwards compatibility [#2395]
Ok, ACK. -AVM On 4/7/2017 1:05 PM, Anders Widell wrote: > 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.o
Re: [devel] [PATCH 1 of 1] ckpt: Add option OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 for backwards compatibility [#2395]
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
Re: [devel] [PATCH 1 of 1] ckpt: Add option OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 for backwards compatibility [#2395]
One more comment added to previous mail. On 4/7/2017 8:47 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 - Add `export` before`OSAF_CKPT_SHM_ALLOC_GUARANTEE=` -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; >
Re: [devel] [PATCH 1 of 1] ckpt: Add option OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 for backwards compatibility [#2395]
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 -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 =
[devel] [PATCH 1 of 1] ckpt: Add option OSAF_CKPT_SHM_ALLOC_GUARANTEE=2 for backwards compatibility [#2395]
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.ensure