linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Hillf Danton" <hillf.zj@alibaba-inc.com>
To: Hugh Dickins <hughd@google.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>, linux-mm@kvack.org
Subject: shmem: Are we accounting block right?
Date: Fri, 05 Aug 2016 14:54:23 +0800	[thread overview]
Message-ID: <006b01d1eee6$338c0c40$9aa424c0$@alibaba-inc.com> (raw)

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>

             reply	other threads:[~2016-08-05 16:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05  6:54 Hillf Danton [this message]
2016-08-06  8:12 ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='006b01d1eee6$338c0c40$9aa424c0$@alibaba-inc.com' \
    --to=hillf.zj@alibaba-inc.com \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox