* shmem: Are we accounting block right?
@ 2016-08-05 6:54 Hillf Danton
2016-08-06 8:12 ` Hugh Dickins
0 siblings, 1 reply; 2+ messages in thread
From: Hillf Danton @ 2016-08-05 6:54 UTC (permalink / raw)
To: Hugh Dickins, Kirill A. Shutemov; +Cc: Hillf Danton, linux-mm
Hi all
Currently in mainline we do block account if the flags parameter
carries VM_NORESERVE.
But blocks should be accounted if reserved, as shown by the
following diff.
Am I missing anything?
thanks
Hillf
--- a/mm/shmem.c Fri Aug 5 14:01:59 2016
+++ b/mm/shmem.c Fri Aug 5 14:36:31 2016
@@ -168,7 +168,7 @@ static inline int shmem_reacct_size(unsi
*/
static inline int shmem_acct_block(unsigned long flags, long pages)
{
- if (!(flags & VM_NORESERVE))
+ if (flags & VM_NORESERVE)
return 0;
return security_vm_enough_memory_mm(current->mm,
@@ -177,7 +177,7 @@ static inline int shmem_acct_block(unsig
static inline void shmem_unacct_blocks(unsigned long flags, long pages)
{
- if (flags & VM_NORESERVE)
+ if (!(flags & VM_NORESERVE))
vm_unacct_memory(pages * VM_ACCT(PAGE_SIZE));
}
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: shmem: Are we accounting block right?
2016-08-05 6:54 shmem: Are we accounting block right? Hillf Danton
@ 2016-08-06 8:12 ` Hugh Dickins
0 siblings, 0 replies; 2+ messages in thread
From: Hugh Dickins @ 2016-08-06 8:12 UTC (permalink / raw)
To: Hillf Danton; +Cc: Hugh Dickins, Kirill A. Shutemov, linux-mm
On Fri, 5 Aug 2016, Hillf Danton wrote:
> Hi all
>
> Currently in mainline we do block account if the flags parameter
> carries VM_NORESERVE.
Yes. (VM_NORESERVE being set in tmpfs file flags,
but usually not on SysV SHM and mmaps of /dev/zero.)
>
> But blocks should be accounted if reserved, as shown by the
> following diff.
Blocks should be accounted one by one as they are instantiated
(tmpfs), unless the total size was all reserved upfront (SHM).
>
> Am I missing anything?
Apparently, but I'm not sure what. Maybe the comments
above shmem_acct_size() and shmem_acct_block() will help.
Hugh
>
> thanks
> Hillf
>
> --- a/mm/shmem.c Fri Aug 5 14:01:59 2016
> +++ b/mm/shmem.c Fri Aug 5 14:36:31 2016
> @@ -168,7 +168,7 @@ static inline int shmem_reacct_size(unsi
> */
> static inline int shmem_acct_block(unsigned long flags, long pages)
> {
> - if (!(flags & VM_NORESERVE))
> + if (flags & VM_NORESERVE)
> return 0;
>
> return security_vm_enough_memory_mm(current->mm,
> @@ -177,7 +177,7 @@ static inline int shmem_acct_block(unsig
>
> static inline void shmem_unacct_blocks(unsigned long flags, long pages)
> {
> - if (flags & VM_NORESERVE)
> + if (!(flags & VM_NORESERVE))
> vm_unacct_memory(pages * VM_ACCT(PAGE_SIZE));
> }
>
> --
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-06 8:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-05 6:54 shmem: Are we accounting block right? Hillf Danton
2016-08-06 8:12 ` Hugh Dickins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox