From: Andrea Arcangeli <andrea@suse.de>
To: "Eric W. Biederman" <ebiederm+eric@ccr.net>
Cc: Linus Torvalds <torvalds@transmeta.com>,
linux-kernel@vger.rutgers.edu, linux-mm@kvack.org
Subject: Re: [PATCH] cache large files in the page cache
Date: Mon, 24 May 1999 17:27:20 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.05.9905241701300.2102-100000@laser.random> (raw)
In-Reply-To: <m17lpzsi0h.fsf@flinx.ccr.net>
On 23 May 1999, Eric W. Biederman wrote:
>diff -uNrX /home/eric/projects/linux/linux-ignore-files linux-2.3.3.eb4/drivers/sgi/char/graphics.c linux-2.3.3.eb5/drivers/sgi/char/graphics.c
>--- linux-2.3.3.eb4/drivers/sgi/char/graphics.c Sun Oct 11 13:15:06 1998
>+++ linux-2.3.3.eb5/drivers/sgi/char/graphics.c Sat May 22 17:16:53 1999
>@@ -237,12 +237,20 @@
> };
>
> int
>-sgi_graphics_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma)
>+sgi_graphics_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma,
>+ loff_t offset)
> {
> uint size;
>+ unsigned long vm_offset;
>+
>+ if (offset > PAGE_MAX_MEMORY_OFFSET) {
>+ return -EINVAL;
>+ }
>+ vm_offset = offset;
>+ vma->vm_index = vm_offset >> PAGE_SHIFT;
>
> size = vma->vm_end - vma->vm_start;
>- if (vma->vm_offset & ~PAGE_MASK)
>+ if (vm_offset & ~PAGE_MASK)
> return -ENXIO;
>
> /* 1. Set our special graphic virtualizer */
>@@ -252,7 +260,8 @@
> vma->vm_page_prot = PAGE_USERIO;
>
> /* final setup */
>- vma->vm_dentry = dget (file->f_dentry);
>+ vma->vm_file = file;
>+ file->f_count++;
> return 0;
vm_file a and f_count should be just handled by do_mmap().
>@@ -365,8 +370,8 @@
> > (unsigned long) current->rlim[RLIMIT_AS].rlim_cur)
> return -ENOMEM;
> vma->vm_start = address;
>- vma->vm_offset -= grow;
>- vma->vm_mm->total_vm += grow >> PAGE_SHIFT;
>+ vma->vm_index -= grow >> PAGE_SHIFT;
>+ vma->vm_mm->total_vm += grow;
^^^^
grow should still be shifted right of PAGE_SHIFT I think.
I have not understood why PAGE_MAX_MEMORY_OFFSET & PAGE_MAX_FILE_OFFSET
are useful. We should check against too large offset or too high mmap in
the standard code, no? Maybe the offset limit is to forbid somebody to
create a too much large file even if the fs would permit? I am not sure if
it will be useful, at least if it's choosen at compile time and it's not a
sysctl.
Andrea Arcangeli
--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/
next prev parent reply other threads:[~1999-05-24 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-23 19:28 Eric W. Biederman
1999-05-24 15:27 ` Andrea Arcangeli [this message]
1999-05-26 7:44 ` Jakub Jelinek
1999-05-26 17:44 ` Linus Torvalds
1999-05-30 17:17 ` Eric W. Biederman
1999-05-30 17:47 ` Linus Torvalds
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=Pine.LNX.4.05.9905241701300.2102-100000@laser.random \
--to=andrea@suse.de \
--cc=ebiederm+eric@ccr.net \
--cc=linux-kernel@vger.rutgers.edu \
--cc=linux-mm@kvack.org \
--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