From: Adam Litke <agl@us.ibm.com>
To: linux-mm@kvack.org
Cc: agl@us.ibm.com, wli@holomorphy.com, kenchen@google.com,
hugh@veritas.com, david@gibson.dropbear.id.au
Subject: [PATCH 4/6] hugetlb: hugetlbfs handles overcommit accounting privately
Date: Wed, 31 Jan 2007 12:17:07 -0800 [thread overview]
Message-ID: <20070131201707.13810.65461.stgit@localhost.localdomain> (raw)
In-Reply-To: <20070131201624.13810.45848.stgit@localhost.localdomain>
In do_mmap_pgoff, is_file_hugepages() is used to determine whether the default
overcommit accounting checks should be performed. The underlying question is
whether the "device" handles the overcommit logic instead of using the generic
logic. Add a backing_dev_info .capability flag which allows the underlying
"device" to specify the answer to this question directly.
This lets us remove another call to is_file_hugepages().
Signed-off-by: Adam Litke <agl@us.ibm.com>
---
fs/hugetlbfs/inode.c | 3 ++-
include/linux/backing-dev.h | 6 ++++++
mm/mmap.c | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index c95dc47..b61592f 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -41,7 +41,8 @@ static struct inode_operations hugetlbfs_inode_operations;
static struct backing_dev_info hugetlbfs_backing_dev_info = {
.ra_pages = 0, /* No readahead */
- .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
+ .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK | \
+ BDI_CAP_PRIVATE_ACCT,
};
int sysctl_hugetlb_shm_group;
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 7011d62..73ef6e5 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -50,6 +50,7 @@ struct backing_dev_info {
#define BDI_CAP_READ_MAP 0x00000010 /* Can be mapped for reading */
#define BDI_CAP_WRITE_MAP 0x00000020 /* Can be mapped for writing */
#define BDI_CAP_EXEC_MAP 0x00000040 /* Can be mapped for execution */
+#define BDI_CAP_PRIVATE_ACCT 0x00000080 /* Overcommit accounting handled privately */
#define BDI_CAP_VMFLAGS \
(BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
@@ -101,11 +102,16 @@ void congestion_end(int rw);
#define bdi_cap_account_dirty(bdi) \
(!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY))
+#define bdi_cap_private_acct(bdi) \
+ ((bdi)->capabilities & BDI_CAP_PRIVATE_ACCT)
+
#define mapping_cap_writeback_dirty(mapping) \
bdi_cap_writeback_dirty((mapping)->backing_dev_info)
#define mapping_cap_account_dirty(mapping) \
bdi_cap_account_dirty((mapping)->backing_dev_info)
+#define mapping_cap_private_acct(mapping) \
+ bdi_cap_private_acct((mapping)->backing_dev_info)
#endif /* _LINUX_BACKING_DEV_H */
diff --git a/mm/mmap.c b/mm/mmap.c
index cc3a208..a5cb0a5 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -994,7 +994,7 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
return -EPERM;
vm_flags &= ~VM_MAYEXEC;
}
- if (is_file_hugepages(file))
+ if (mapping_cap_private_acct(file->f_mapping))
accountable = 0;
if (!file->f_op || !file->f_op->mmap)
--
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>
next prev parent reply other threads:[~2007-01-31 20:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-31 20:16 [PATCH 0/6] hugetlb: Remove is_file_hugepages() macro Adam Litke
2007-01-31 20:16 ` [PATCH 1/6] Define the shmem_inode_info flags directly Adam Litke
2007-01-31 20:16 ` [PATCH 2/6] hugetlb: share shmem_inode_info Adam Litke
2007-01-31 20:16 ` [PATCH 3/6] Use inode_info to annotate hugetlbfs shm segments Adam Litke
2007-01-31 20:17 ` Adam Litke [this message]
2007-01-31 20:17 ` [PATCH 5/6] Abstract is_hugepage_only_range Adam Litke
2007-01-31 20:17 ` [PATCH 6/6] hugetlb: Remove is_file_hugepages() Adam Litke
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=20070131201707.13810.65461.stgit@localhost.localdomain \
--to=agl@us.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=hugh@veritas.com \
--cc=kenchen@google.com \
--cc=linux-mm@kvack.org \
--cc=wli@holomorphy.com \
/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;
as well as URLs for NNTP newsgroup(s).