public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-kernel@vger.kernel.org
Subject: Re: pgcl-2.6.0-test5-bk3-17
Date: Fri, 28 Nov 2003 15:51:55 -0800	[thread overview]
Message-ID: <20031128235155.GA19856@holomorphy.com> (raw)
In-Reply-To: <20031128072148.GY8039@holomorphy.com>

On Thu, Nov 27, 2003 at 08:15:58PM -0800, William Lee Irwin III wrote:
>> This is a forward port of Hugh Dickins' patch to implement ABI-
>> preserving large software PAGE_SIZE support, effectively "large VM
>> blocksize". It's also been called "subpages". "pgcl" is an abbreviation
>> for "page clustering", after the historical but different BSD notion.

On Thu, Nov 27, 2003 at 11:21:48PM -0800, William Lee Irwin III wrote:
> Now also ported to 2.6.0-test11:
> ftp://ftp.kernel.org/pub/linux/kernel/people/wli/vm/pgcl/pgcl-2.6.0-test11-1.gz
> This also corrects some PAGE_SHIFT instances that crept into mm/mmap.c
> while I wasn't looking and drops sym2 driver changes.

Looks like I missed the update to the Committed_AS accounting in exec.c
during the conversion. The reduced granularity on RLIMIT_STACK, stack
fault alignment,  and the argument size Committed_AS accounting bothers
me. I should teach copy_folio() etc. to cope with unaligned pages, but
there appears to be some pain wrt. how far and wide to hunt for ptes
(i.e. this requires some design effort).

I do the swap bits a bit differently from the original, so the
swapfile accounting needs a unit conversion.

This also arranges for pr_debug()-based logging of Committed_AS
accounting, which is useful while this thing is still prototypical in
nature, but will eventually get removed for "production" patch posting
along with several other things of a similar nature.


-- wli


diff -prauN pgcl-2.6.0-test11-1/fs/exec.c pgcl-2.6.0-test11-2/fs/exec.c
--- pgcl-2.6.0-test11-1/fs/exec.c	2003-11-27 21:55:19.000000000 -0800
+++ pgcl-2.6.0-test11-2/fs/exec.c	2003-11-28 15:25:51.000000000 -0800
@@ -417,7 +417,7 @@ int setup_arg_pages(struct linux_binprm 
 #else
 	stack_base = STACK_TOP - MAX_ARG_PAGES * PAGE_SIZE;
 	mm->arg_start = bprm->p + stack_base;
-	arg_size = STACK_TOP - (MMUPAGE_MASK & (unsigned long) mm->arg_start);
+	arg_size = STACK_TOP - (PAGE_MASK & (unsigned long) mm->arg_start);
 #endif
 
 	bprm->p += stack_base;
diff -prauN pgcl-2.6.0-test11-1/include/linux/mman.h pgcl-2.6.0-test11-2/include/linux/mman.h
--- pgcl-2.6.0-test11-1/include/linux/mman.h	2003-11-26 12:43:05.000000000 -0800
+++ pgcl-2.6.0-test11-2/include/linux/mman.h	2003-11-28 15:26:08.000000000 -0800
@@ -14,18 +14,42 @@ extern int sysctl_overcommit_memory;
 extern int sysctl_overcommit_ratio;
 extern atomic_t vm_committed_space;
 
+#define vm_acct_memory(pages)						\
+do {									\
+	long __pages__ = (pages);					\
+	pr_debug("%d: vm_acct_memory(%ld) in %s at %s:%d\n",		\
+		current->pid,						\
+		__pages__,						\
+		__FUNCTION__,						\
+		__FILE__,						\
+		__LINE__);						\
+	__vm_acct_memory(__pages__);					\
+} while (0)
+
+#define vm_unacct_memory(pages)						\
+do {									\
+	long __pages__ = (pages);					\
+	pr_debug("%d: vm_unacct_memory(%ld) in %s at %s:%d\n",		\
+		current->pid,						\
+		__pages__,						\
+		__FUNCTION__,						\
+		__FILE__,						\
+		__LINE__);						\
+	__vm_unacct_memory(__pages__);					\
+} while (0)
+
 #ifdef CONFIG_SMP
-extern void vm_acct_memory(long pages);
+void __vm_acct_memory(long pages);
 #else
-static inline void vm_acct_memory(long pages)
+static inline void __vm_acct_memory(long pages)
 {
 	atomic_add(pages, &vm_committed_space);
 }
 #endif
 
-static inline void vm_unacct_memory(long pages)
+static inline void __vm_unacct_memory(long pages)
 {
-	vm_acct_memory(-pages);
+	__vm_acct_memory(-pages);
 }
 
 /*
diff -prauN pgcl-2.6.0-test11-1/include/linux/security.h pgcl-2.6.0-test11-2/include/linux/security.h
--- pgcl-2.6.0-test11-1/include/linux/security.h	2003-11-26 12:44:57.000000000 -0800
+++ pgcl-2.6.0-test11-2/include/linux/security.h	2003-11-28 15:26:01.000000000 -0800
@@ -84,6 +84,18 @@ struct nfsctl_arg;
 struct sched_param;
 struct swap_info_struct;
 
+#define security_vm_enough_memory(pages)				\
+({									\
+	long __pages__ = (pages);					\
+	pr_debug("%d: vm_enough_memory(%ld) in %s at %s:%d\n",		\
+		current->pid,						\
+		__pages__,						\
+		__FUNCTION__,						\
+		__FILE__,						\
+		__LINE__);						\
+	__security_vm_enough_memory(__pages__);				\
+})
+
 #ifdef CONFIG_SECURITY
 
 /**
@@ -1245,7 +1257,7 @@ static inline int security_syslog(int ty
 	return security_ops->syslog(type);
 }
 
-static inline int security_vm_enough_memory(long pages)
+static inline int __security_vm_enough_memory(long pages)
 {
 	return security_ops->vm_enough_memory(pages);
 }
@@ -1911,7 +1923,7 @@ static inline int security_syslog(int ty
 	return cap_syslog(type);
 }
 
-static inline int security_vm_enough_memory(long pages)
+static inline int __security_vm_enough_memory(long pages)
 {
 	return cap_vm_enough_memory(pages);
 }
diff -prauN pgcl-2.6.0-test11-1/mm/swap.c pgcl-2.6.0-test11-2/mm/swap.c
--- pgcl-2.6.0-test11-1/mm/swap.c	2003-11-27 21:55:21.000000000 -0800
+++ pgcl-2.6.0-test11-2/mm/swap.c	2003-11-28 14:14:50.000000000 -0800
@@ -367,7 +367,7 @@ unsigned int pagevec_lookup(struct pagev
 
 static DEFINE_PER_CPU(long, committed_space) = 0;
 
-void vm_acct_memory(long pages)
+void __vm_acct_memory(long pages)
 {
 	long *local;
 
@@ -380,7 +380,7 @@ void vm_acct_memory(long pages)
 	}
 	preempt_enable();
 }
-EXPORT_SYMBOL(vm_acct_memory);
+EXPORT_SYMBOL(__vm_acct_memory);
 #endif
 
 #ifdef CONFIG_SMP
diff -prauN pgcl-2.6.0-test11-1/mm/swapfile.c pgcl-2.6.0-test11-2/mm/swapfile.c
--- pgcl-2.6.0-test11-1/mm/swapfile.c	2003-11-27 21:55:21.000000000 -0800
+++ pgcl-2.6.0-test11-2/mm/swapfile.c	2003-11-28 01:23:45.000000000 -0800
@@ -1151,8 +1151,8 @@ asmlinkage long sys_swapoff(const char _
 		swap_list_unlock();
 		goto out_dput;
 	}
-	if (!security_vm_enough_memory(p->pages))
-		vm_unacct_memory(p->pages);
+	if (!security_vm_enough_memory(PAGE_MMUCOUNT*p->pages))
+		vm_unacct_memory(PAGE_MMUCOUNT*p->pages);
 	else {
 		err = -ENOMEM;
 		swap_list_unlock();

  reply	other threads:[~2003-11-28 23:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-28  4:15 pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-11-28  7:21 ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-11-28 23:51   ` William Lee Irwin III [this message]
2003-11-30  1:12   ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-11-30 16:43   ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-11-30 18:46     ` pgcl-2.6.0-test5-bk3-17 Zwane Mwaikambo
2003-11-30 18:50       ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-12-01  7:36     ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-12-01  7:44       ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-12-07  7:28       ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-12-07 18:45         ` pgcl-2.6.0-test5-bk3-17 Zwane Mwaikambo
2003-12-07 19:12           ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III
2003-12-01 16:46     ` pgcl-2.6.0-test5-bk3-17 William Lee Irwin III

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=20031128235155.GA19856@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=linux-kernel@vger.kernel.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