Re: [PATCH] IPC: account for kmem usage on mqueue and msg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 18-10-16 11:54:35, Aristeu Rozanski wrote:
> When kmem accounting switched from account by default to only account if
> flagged by __GFP_ACCOUNT, IPC mqueue and messages was left out.

I guess this was because ipv msgqueue shouldn't allow for memory
consumption runaways. The number of message queues and messages pending
in them is bounded and not a large amount of memory AFAIR. Anyway I do
not see anything unreasonable about accounting the memory to the caller.

Have you noticed this by a code inspection or you have a real world
usecase where the missing accounting caused some problems? This would be
a useful information for the changelog.

> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> Cc: Davidlohr Bueso <dave@xxxxxxxxxxxx>
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Michal Hocko <mhocko@xxxxxxxxxx>
> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx>
> Cc: Stefan Schimanski <sttts@xxxxxxxxxx>
> Reported-by: Stefan Schimanski <sttts@xxxxxxxxxx>
> Signed-off-by: Aristeu Rozanski <arozansk@xxxxxxxxxx>

I am not familiar with this code enough to give my ack but I do not see
anything obviously wrong either.

> ---
>  ipc/msgutil.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ipc/msgutil.c b/ipc/msgutil.c
> index a521999..bf74eaa 100644
> --- a/ipc/msgutil.c
> +++ b/ipc/msgutil.c
> @@ -53,7 +53,7 @@ static struct msg_msg *alloc_msg(size_t len)
>  	size_t alen;
>  
>  	alen = min(len, DATALEN_MSG);
> -	msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL);
> +	msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL_ACCOUNT);
>  	if (msg == NULL)
>  		return NULL;
>  
> @@ -65,7 +65,7 @@ static struct msg_msg *alloc_msg(size_t len)
>  	while (len > 0) {
>  		struct msg_msgseg *seg;
>  		alen = min(len, DATALEN_SEG);
> -		seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL);
> +		seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL_ACCOUNT);
>  		if (seg == NULL)
>  			goto out_err;
>  		*pseg = seg;
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe cgroups" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux