From: Andrew Morton <akpm@zip.com.au>
To: Robert Love <rml@tech9.net>
Cc: torvalds@transmeta.com, riel@conectiva.com.br,
linux-kernel@vger.kernel.org, alan@redhat.com
Subject: Re: [PATCH] 2.5.28: VM strict overcommit
Date: Wed, 24 Jul 2002 20:21:31 -0700 [thread overview]
Message-ID: <3D3F6EBB.3B7817C5@zip.com.au> (raw)
In-Reply-To: 1027556984.3581.1643.camel@sinai
Robert Love wrote:
>
> Andrew and Linus,
>
> Here again is a port of Alan's VM strict overcommit to the 2.5 kernel,
> with the new policy design Alan and I discussed.
>
static int shmem_notify_change(struct dentry * dentry, struct iattr *attr)
{
struct inode *inode = dentry->d_inode;
int error;
if (attr->ia_valid & ATTR_SIZE) {
/*
* Account swap file usage based on new file size
*/
long change = (attr->ia_size>>PAGE_SHIFT) - (inode->i_size >> PAGE_SHIFT);
If the size is changing from 4096 to 4097, `change' will be zero, yes?
Should be
((ia_size + PAGE_SIZE - 1) >> PAGE_SHIFT) -
((i_size + PAGE_SIZE - 1) >> PAGE_SHIFT)
----------------------
static ssize_t
shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
{
...
maxpos = inode->i_size;
if (pos + count > inode->i_size) {
maxpos = pos + count;
if (!vm_enough_memory((maxpos - inode->i_size) >> PAGE_SHIFT)) {
err = -ENOMEM;
goto out_nc;
}
}
tmpfs supports holes. Looks to me like a small write which creates
a big hole will be severely over-accounted for?
vm_enough_memory() looks really slow. I'll bench this a bit.
The expression `(maxpos - inode->i_size) >> PAGE_SHIFT' doesn't accurately
count the number of pages which will be added....
-----------------------
dum_mmap():
if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
are vm_start and vm_end guaranteed to be a multiple of PAGE_SIZE?
General comment: the on-demand beancounting in vm_enough_memory()
may be something we need in other places - thinking here of
balance_dirty_pages(). Its current policy of "throttle if 40%
of memory is dirty" is junk. It really wants to know more
information about the dynamic state of the system. So tracking
all those datums on-the-fly would be handy. One day.
-
next prev parent reply other threads:[~2002-07-25 3:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-25 0:29 [PATCH] 2.5.28: VM strict overcommit Robert Love
2002-07-25 3:21 ` Andrew Morton [this message]
2002-07-25 8:18 ` Alan Cox
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=3D3F6EBB.3B7817C5@zip.com.au \
--to=akpm@zip.com.au \
--cc=alan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=riel@conectiva.com.br \
--cc=rml@tech9.net \
--cc=torvalds@transmeta.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