[LTP] [PATCH] memcg_process: cleanup the SHM segment

Cyril Hrubis chrubis@suse.cz
Tue Sep 6 18:01:26 CEST 2016


Hi!
> Let's mark the segment for removal right after we attach it.
> This way memcg* test cases will no longer leave unused
> segments after they finish.
> 
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
>  .../controllers/memcg/functional/memcg_process.c   |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> index fbb76e2..e2c60de 100644
> --- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> @@ -234,9 +234,6 @@ static void shm(void)
>  		if (key == -1)
>  			err(1, "ftok() failed");
>  
> -		shmid = shmget(key, memsize, flag);
> -		if (shmid == -1)
> -			err(1, "shmget() failed");
>  		shmctl(shmid, IPC_RMID, NULL);
                     ^
Shouldn't we remove this IPC_RMID as well?


Otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list