* Re: test13-pre3
@ 2000-12-19 0:58 Dieter Nützel
0 siblings, 0 replies; 9+ messages in thread
From: Dieter Nützel @ 2000-12-19 0:58 UTC (permalink / raw)
To: Linux Kernel List; +Cc: Rik Faith, Dri-devel, Alan Cox
> List: linux-kernel
> Subject: Re: test13-pre3 woes
> From: Peter Samuelson <peter@cadcamlab.org>
> Date: 2000-12-18 9:19:13
> [Download message RAW]
>
>
> [J Sloan]
> > The module now compiles and gets installed -
> > Unfortunately, attempting to load it does not go well:
> >
> > kernel/drivers/char/drm/tdfx.o: unresolved symbol remap_page_range
> > kernel/drivers/char/drm/tdfx.o: unresolved symbol __wake_up
> > kernel/drivers/char/drm/tdfx.o: unresolved symbol mtrr_add
> > kernel/drivers/char/drm/tdfx.o: unresolved symbol __generic_copy_from_user
> > kernel/drivers/char/drm/tdfx.o: unresolved symbol schedule
> > kernel/drivers/char/drm/tdfx.o: unresolved symbol kmalloc
> > kernel/drivers/char/drm/tdfx.o: unresolved symbol si_meminfo
>
> Those symbols are rather generic and rather important. Sounds like a
> generic module problem. Do other modules load? Does your kernel use
> MODVERSIONS? (This module apparently doesn't.) Are you using a recent
> version of modutils?
>
> Puzzled. Maybe Keith Owens knows something.
>
> Peter
I got this, too. The one liner send here on lkm seems to be not enough. Even
Alan's ac1/2 did not do the trick. The 'new' Linux makefile changes brake
this stuff. It works before these changes.
So Rik any comments?
Thanks,
Dieter
--
Dieter Nützel
Graduate Student, Computer Science
University of Hamburg
Department of Computer Science
Cognitive Systems Group
Vogt-Kölln-Straße 30
D-22527 Hamburg, Germany
email: nuetzel@kogs.informatik.uni-hamburg.de
@home: Dieter.Nuetzel@hamburg.de
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: test13-pre3
@ 2000-12-18 17:35 Petr Vandrovec
2000-12-18 17:18 ` test13-pre3 Maciej W. Rozycki
0 siblings, 1 reply; 9+ messages in thread
From: Petr Vandrovec @ 2000-12-18 17:35 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: Kernel Mailing List, mingo, torvalds
On 18 Dec 00 at 13:58, Maciej W. Rozycki wrote:
> What is this change about?
>
> diff -u --recursive --new-file v2.4.0-test12/linux/arch/i386/kernel/smpboot.c linux/arch/i386/kernel/smpboot.c
> --- v2.4.0-test12/linux/arch/i386/kernel/smpboot.c Mon Dec 11 17:59:43 2000
> +++ linux/arch/i386/kernel/smpboot.c Thu Dec 14 14:54:40 2000
> @@ -694,6 +694,11 @@
> apic_write_around(APIC_ICR, APIC_DM_STARTUP
> | (start_eip >> 12));
>
> + /*
> + * Give the other CPU some time to accept the IPI.
> + */
> + udelay(300);
> +
> Dprintk("Startup point 1.\n");
>
> Dprintk("Waiting for send to finish...\n");
>
> There is the following code is just after it, making the above change
> just useless garbage:
No. Without udelay() before first printk() it just does not boot on my
motherboard. There were two choices: either remove all printk() from
these loops (define Dprintk to null), or add udelay(x), where x >= 200,
before first printk. I sent patch twice to linux-kernel, and to
mingo@redhat.com, and nobody said anything against it.
> timeout = 0;
> do {
> Dprintk("+");
> udelay(100);
> send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
> } while (send_status && (timeout++ < 1000));
>
> /*
> * Give the other CPU some time to accept the IPI.
> */
> udelay(200);
>
> If we need 600usecs of delay for certain systems, then why not just make
> it like below?
No. If there is no udelay() before first printk(), on my GA-6VXD7 board
(SMP VIA 694X) only 'Startup point 1.' is printed, but no 'Waiting
for send to finish...'. So maybe we do not need udelay(200) below loop,
but for sure we need udelay() before first printk(). (my board works
without ANY udelay() in smpboot.c, except one I added... This one is
required.) If somebody lives in Prague, and wants to come with logical
analyzer (or if I should come with motherboard), I'm willing to continue
testing. But current idea is that inb/outb done by cursor positioning
code is incompatible with something else done in secondary CPU startup.
(it boots also without any kernel change with 'console=ttyS0,9600', but
it may be caused by slow serial line)
Without delay() both CPU die, and board does not react to anything except
hard reset anymore (and sometime it does not react even to hard reset; lookup
for my messages during last week).
Best regards,
Petr Vandrovec
vandrove@vc.cvut.cz
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: test13-pre3
2000-12-18 17:35 test13-pre3 Petr Vandrovec
@ 2000-12-18 17:18 ` Maciej W. Rozycki
0 siblings, 0 replies; 9+ messages in thread
From: Maciej W. Rozycki @ 2000-12-18 17:18 UTC (permalink / raw)
To: Petr Vandrovec; +Cc: Kernel Mailing List, mingo, torvalds
On Mon, 18 Dec 2000, Petr Vandrovec wrote:
> No. Without udelay() before first printk() it just does not boot on my
> motherboard. There were two choices: either remove all printk() from
> these loops (define Dprintk to null), or add udelay(x), where x >= 200,
> before first printk. I sent patch twice to linux-kernel, and to
> mingo@redhat.com, and nobody said anything against it.
I see. But are you sure this is the right fix? You may be covering
the real problem with this arbitrary delay.
I haven't actually noticed any of your previous mails -- given the load
on the list I sometimes miss letters with "uninteresting" subjects.
> No. If there is no udelay() before first printk(), on my GA-6VXD7 board
> (SMP VIA 694X) only 'Startup point 1.' is printed, but no 'Waiting
> for send to finish...'. So maybe we do not need udelay(200) below loop,
> but for sure we need udelay() before first printk(). (my board works
> without ANY udelay() in smpboot.c, except one I added... This one is
> required.) If somebody lives in Prague, and wants to come with logical
Other delays are imposed by the MPS (most if not all of them). For
example there are systems that assert RESET to a CPU as a result of an
INIT IPI. These systems need these delays to allow CPUs to recover.
> analyzer (or if I should come with motherboard), I'm willing to continue
> testing. But current idea is that inb/outb done by cursor positioning
> code is incompatible with something else done in secondary CPU startup.
Have you tried putting explicit display adapter (other ISA) I/O accesses
after sending the IPI to see if they trigger the problem? IPIs are
transmitted over the inter-APIC bus and should be completely invisible to
other parts of the system. But the code involved in processing a printk()
may interact with the one executed by another CPU right after waking it
up. It would be worth to investigate it...
> (it boots also without any kernel change with 'console=ttyS0,9600', but
> it may be caused by slow serial line)
Or by running different code.
> Without delay() both CPU die, and board does not react to anything except
> hard reset anymore (and sometime it does not react even to hard reset; lookup
> for my messages during last week).
Now THAT is weird. It might mean a chipset bug. Still no idea how an
inter-APIC message might trigger it -- it completely bypasses MB
chipset... Hmm, maybe not... Is your I/O APIC discrete (like Intel's
82093AA) or integrated? It appears there are vendors manufacturing I/O
APIC clones and this may imply new problems, sigh...
Maciej
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread
* test13-pre3
@ 2000-12-17 21:55 Linus Torvalds
2000-12-17 23:43 ` test13-pre3 Albert Cranford
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Linus Torvalds @ 2000-12-17 21:55 UTC (permalink / raw)
To: Kernel Mailing List
The most noticeable part of this is that the run_task_queue fix should
cure the lockup that some people have seen.
The shmfs cleanup should be unnoticeable except to users who use SAP with
huge shared memory segments, where Christoph Rohlands work not only
makes the code much more readable, it should also make it dependable..
Linus
----
- pre3:
- Christian Jullien: smc9194: proper dev_kfree_skb_irq
- Cort Dougan: new-style PowerPC Makefiles
- Andrew Morton, Petr Vandrovec: fix run_task_queue
- Christoph Rohland: shmfs for shared memory handling
- pre2:
- Kai Germaschewski: ISDN update (including Makefiles)
- Jens Axboe: cdrom updates
- Petr Vandrovec; Matrox G450 support
- Bill Nottingham: fix FAT32 filesystems on 64-bit platforms
- David Miller: sparc (and other) Makefile fixup
- Andrea Arkangeli: alpha SMP TLB context fix (and cleanups)
- Niels Kristian Bech Jensen: checkconfig, USB warnings
- Andrew Grover: large ACPI update
- pre1:
- me: drop support for old-style Makefiles entirely. Big.
- me: check b_end_io at the IO submission path
- me: fix "ptep_mkdirty()" (so that swapoff() works correctly)
- fix fault case in copy_from_user() with a constant size, where
((size & 3) == 3)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: test13-pre3
2000-12-17 21:55 test13-pre3 Linus Torvalds
@ 2000-12-17 23:43 ` Albert Cranford
2000-12-18 6:00 ` test13-pre3 Peter Samuelson
2000-12-18 12:58 ` test13-pre3 Maciej W. Rozycki
2000-12-18 14:34 ` test13-pre3 Christoph Rohland
2 siblings, 1 reply; 9+ messages in thread
From: Albert Cranford @ 2000-12-17 23:43 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
With CONFIG_DRM_R128=m
we fail to produce module linux/drivers/char/drm/r128.o
Any thoughts.
Albert
Linus Torvalds wrote:
>
> The most noticeable part of this is that the run_task_queue fix should
> cure the lockup that some people have seen.
>
> The shmfs cleanup should be unnoticeable except to users who use SAP with
> huge shared memory segments, where Christoph Rohlands work not only
> makes the code much more readable, it should also make it dependable..
>
> Linus
>
> ----
>
> - pre3:
> - Christian Jullien: smc9194: proper dev_kfree_skb_irq
> - Cort Dougan: new-style PowerPC Makefiles
> - Andrew Morton, Petr Vandrovec: fix run_task_queue
> - Christoph Rohland: shmfs for shared memory handling
>
--
Albert Cranford Deerfield Beach FL USA
ac9410@bellsouth.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: test13-pre3
2000-12-17 23:43 ` test13-pre3 Albert Cranford
@ 2000-12-18 6:00 ` Peter Samuelson
0 siblings, 0 replies; 9+ messages in thread
From: Peter Samuelson @ 2000-12-18 6:00 UTC (permalink / raw)
To: Albert Cranford; +Cc: Linus Torvalds, Kernel Mailing List
[Albert Cranford]
> With CONFIG_DRM_R128=m
> we fail to produce module linux/drivers/char/drm/r128.o
He's right. Linus, please apply.
Peter
--- test13pre3/drivers/char/Makefile.orig Wed Dec 13 23:56:01 2000
+++ test13pre3/drivers/char/Makefile Sun Dec 17 23:55:00 2000
@@ -25,6 +25,7 @@
misc.o pty.o random.o selection.o serial.o \
tty_io.o
+mod-subdirs := joystick ftape drm pcmcia
list-multi :=
KEYMAP =defkeymap.o
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: test13-pre3
2000-12-17 21:55 test13-pre3 Linus Torvalds
2000-12-17 23:43 ` test13-pre3 Albert Cranford
@ 2000-12-18 12:58 ` Maciej W. Rozycki
2000-12-18 14:34 ` test13-pre3 Christoph Rohland
2 siblings, 0 replies; 9+ messages in thread
From: Maciej W. Rozycki @ 2000-12-18 12:58 UTC (permalink / raw)
To: Linus Torvalds, Ingo Molnar; +Cc: Kernel Mailing List
Hi,
What is this change about?
diff -u --recursive --new-file v2.4.0-test12/linux/arch/i386/kernel/smpboot.c linux/arch/i386/kernel/smpboot.c
--- v2.4.0-test12/linux/arch/i386/kernel/smpboot.c Mon Dec 11 17:59:43 2000
+++ linux/arch/i386/kernel/smpboot.c Thu Dec 14 14:54:40 2000
@@ -694,6 +694,11 @@
apic_write_around(APIC_ICR, APIC_DM_STARTUP
| (start_eip >> 12));
+ /*
+ * Give the other CPU some time to accept the IPI.
+ */
+ udelay(300);
+
Dprintk("Startup point 1.\n");
Dprintk("Waiting for send to finish...\n");
There is the following code is just after it, making the above change
just useless garbage:
timeout = 0;
do {
Dprintk("+");
udelay(100);
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
} while (send_status && (timeout++ < 1000));
/*
* Give the other CPU some time to accept the IPI.
*/
udelay(200);
If we need 600usecs of delay for certain systems, then why not just make
it like below?
Maciej
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
patch-2.0.4-test13-pre3-startup_ipi-0
diff -up --recursive --new-file linux-2.4.0-test13-pre3.macro/arch/i386/kernel/smpboot.c linux-2.4.0-test13-pre3/arch/i386/kernel/smpboot.c
--- linux-2.4.0-test13-pre3.macro/arch/i386/kernel/smpboot.c Mon Dec 18 12:14:10 2000
+++ linux-2.4.0-test13-pre3/arch/i386/kernel/smpboot.c Mon Dec 18 12:15:49 2000
@@ -694,11 +694,6 @@ static void __init do_boot_cpu (int apic
apic_write_around(APIC_ICR, APIC_DM_STARTUP
| (start_eip >> 12));
- /*
- * Give the other CPU some time to accept the IPI.
- */
- udelay(300);
-
Dprintk("Startup point 1.\n");
Dprintk("Waiting for send to finish...\n");
@@ -712,7 +707,7 @@ static void __init do_boot_cpu (int apic
/*
* Give the other CPU some time to accept the IPI.
*/
- udelay(200);
+ udelay(500);
/*
* Due to the Pentium erratum 3AP.
*/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: test13-pre3
2000-12-17 21:55 test13-pre3 Linus Torvalds
2000-12-17 23:43 ` test13-pre3 Albert Cranford
2000-12-18 12:58 ` test13-pre3 Maciej W. Rozycki
@ 2000-12-18 14:34 ` Christoph Rohland
2000-12-18 19:24 ` test13-pre3 Christoph Rohland
2 siblings, 1 reply; 9+ messages in thread
From: Christoph Rohland @ 2000-12-18 14:34 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
Hi Linus,
On Sun, 17 Dec 2000, Linus Torvalds wrote:
> The shmfs cleanup should be unnoticeable except to users who use SAP
> with huge shared memory segments, where Christoph Rohlands work not
> only makes the code much more readable, it should also make it
> dependable..
:-)
The appended patch fixes the following:
1) We cannot unlock the page in shmem_writepage on ooswap since
page_launder will do this later.
2) We should set the inode number of SYSV segments to the (user) shmid
and not the internal id.
Greetings
Christoph
diff -uNr 4-13-3/mm/shmem.c c/mm/shmem.c
--- 4-13-3/mm/shmem.c Mon Dec 18 15:08:32 2000
+++ c/mm/shmem.c Mon Dec 18 15:13:10 2000
@@ -210,37 +210,39 @@
{
int error;
struct shmem_inode_info *info;
- swp_entry_t *entry;
+ swp_entry_t *entry, swap;
info = &((struct inode *)page->mapping->host)->u.shmem_i;
if (info->locked)
return 1;
- spin_lock(&info->lock);
- entry = shmem_swp_entry (info, page->index);
- if (!entry) /* this had been allocted on page allocation */
- BUG();
- error = -EAGAIN;
- if (entry->val)
- goto out;
-
/*
* 1 means "cannot write out".
* We can't drop dirty pages
* just because we ran out of
* swap.
*/
- error = 1;
- *entry = __get_swap_page(2);
- if (!entry->val)
+ swap = __get_swap_page(2);
+ if (!swap.val)
+ return 1;
+
+ spin_lock(&info->lock);
+ entry = shmem_swp_entry (info, page->index);
+ if (!entry) /* this had been allocted on page allocation */
+ BUG();
+ error = -EAGAIN;
+ if (entry->val) {
+ __swap_free(swap, 2);
goto out;
+ }
+ *entry = swap;
error = 0;
/* Remove the from the page cache */
lru_cache_del(page);
remove_inode_page(page);
/* Add it to the swap cache */
- add_to_swap_cache(page,*entry);
+ add_to_swap_cache(page, swap);
page_cache_release(page);
SetPageDirty(page);
info->swapped++;
diff -uNr 4-13-3/ipc/shm.c c/ipc/shm.c
--- 4-13-3/ipc/shm.c Mon Dec 18 15:08:32 2000
+++ c/ipc/shm.c Mon Dec 18 15:13:58 2000
@@ -220,7 +220,7 @@
shp->shm_segsz = size;
shp->id = shm_buildid(id,shp->shm_perm.seq);
shp->shm_file = file;
- file->f_dentry->d_inode->i_ino = id;
+ file->f_dentry->d_inode->i_ino = shp->id;
file->f_op = &shm_file_operations;
shm_tot += numpages;
shm_unlock (id);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: test13-pre3
2000-12-18 14:34 ` test13-pre3 Christoph Rohland
@ 2000-12-18 19:24 ` Christoph Rohland
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Rohland @ 2000-12-18 19:24 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
Hi Linus,
On 18 Dec 2000, Christoph Rohland wrote:
> The appended patch fixes the following:
>
> 1) We cannot unlock the page in shmem_writepage on ooswap since
> page_launder will do this later.
>
> 2) We should set the inode number of SYSV segments to the (user)
> shmid and not the internal id.
And here additionally is the SYSV detach/destroy logic fixed which
(again) left destroyed shm segments hang around :-(
I also cleaned up the list of included files in ipc/shm.c
Greetings
Christoph
diff -uNr 4-13-3/ipc/shm.c c/ipc/shm.c
--- 4-13-3/ipc/shm.c Mon Dec 18 15:08:32 2000
+++ c/ipc/shm.c Mon Dec 18 20:07:21 2000
@@ -15,23 +15,13 @@
*
*/
-#include <linux/config.h>
-#include <linux/module.h>
#include <linux/malloc.h>
#include <linux/shm.h>
-#include <linux/swap.h>
-#include <linux/smp_lock.h>
#include <linux/init.h>
-#include <linux/locks.h>
#include <linux/file.h>
#include <linux/mman.h>
-#include <linux/vmalloc.h>
-#include <linux/pagemap.h>
#include <linux/proc_fs.h>
-#include <linux/highmem.h>
-
#include <asm/uaccess.h>
-#include <asm/pgtable.h>
#include "util.h"
@@ -109,6 +99,7 @@
BUG();
shp->shm_atim = CURRENT_TIME;
shp->shm_lprid = current->pid;
+ shp->shm_nattch++;
shm_unlock(id);
}
@@ -123,21 +114,14 @@
*
* @shp: struct to free
*
- * It has to be called with shp and shm_ids.sem locked and will
- * release them
+ * It has to be called with shp and shm_ids.sem locked
*/
static void shm_destroy (struct shmid_kernel *shp)
{
- struct file * file = shp->shm_file;
-
- shp->shm_file = NULL;
shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
- shm_unlock (shp->id);
shm_rmid (shp->id);
+ fput (shp->shm_file);
kfree (shp);
- up (&shm_ids.sem);
- /* put the file outside the critical path to prevent recursion */
- fput (file);
}
/*
@@ -158,10 +142,10 @@
BUG();
shp->shm_lprid = current->pid;
shp->shm_dtim = CURRENT_TIME;
- if(shp->shm_flags & SHM_DEST &&
- file_count (file) == 2) /* shp and the vma have the last
- references*/
- return shm_destroy (shp);
+ shp->shm_nattch--;
+ if(shp->shm_nattch == 0 &&
+ shp->shm_flags & SHM_DEST)
+ shm_destroy (shp);
shm_unlock(id);
up (&shm_ids.sem);
@@ -176,7 +160,7 @@
}
static struct file_operations shm_file_operations = {
- mmap: shm_mmap
+ mmap: shm_mmap
};
static struct vm_operations_struct shm_vm_ops = {
@@ -218,9 +202,10 @@
shp->shm_atim = shp->shm_dtim = 0;
shp->shm_ctim = CURRENT_TIME;
shp->shm_segsz = size;
+ shp->shm_nattch = 0;
shp->id = shm_buildid(id,shp->shm_perm.seq);
shp->shm_file = file;
- file->f_dentry->d_inode->i_ino = id;
+ file->f_dentry->d_inode->i_ino = shp->id;
file->f_op = &shm_file_operations;
shm_tot += numpages;
shm_unlock (id);
@@ -370,15 +355,13 @@
struct inode * inode;
shp = shm_get(i);
- if(shp == NULL || shp->shm_file == NULL)
+ if(shp == NULL)
continue;
inode = shp->shm_file->f_dentry->d_inode;
- down (&inode->i_sem);
- *rss += inode->i_mapping->nrpages;
spin_lock (&inode->u.shmem_i.lock);
+ *rss += inode->i_mapping->nrpages;
*swp += inode->u.shmem_i.swapped;
spin_unlock (&inode->u.shmem_i.lock);
- up (&inode->i_sem);
}
}
@@ -462,7 +445,7 @@
tbuf.shm_ctime = shp->shm_ctim;
tbuf.shm_cpid = shp->shm_cprid;
tbuf.shm_lpid = shp->shm_lprid;
- tbuf.shm_nattch = file_count (shp->shm_file) - 1;
+ tbuf.shm_nattch = shp->shm_nattch;
shm_unlock(shmid);
if(copy_shmid_to_user (buf, &tbuf, version))
return -EFAULT;
@@ -512,13 +495,12 @@
goto out_up;
err = shm_checkid(shp, shmid);
if (err == 0) {
- if (file_count (shp->shm_file) == 1) {
+ if (shp->shm_nattch){
+ shp->shm_flags |= SHM_DEST;
+ /* Do not find it any more */
+ shp->shm_perm.key = IPC_PRIVATE;
+ } else
shm_destroy (shp);
- return 0;
- }
- shp->shm_flags |= SHM_DEST;
- /* Do not find it any more */
- shp->shm_perm.key = IPC_PRIVATE;
}
/* Unlock */
shm_unlock(shmid);
@@ -619,13 +601,23 @@
return -EACCES;
}
file = shp->shm_file;
- get_file (file);
+ shp->shm_nattch++;
shm_unlock(shmid);
down(¤t->mm->mmap_sem);
user_addr = (void *) do_mmap (file, addr, file->f_dentry->d_inode->i_size, prot, flags, 0);
up(¤t->mm->mmap_sem);
- fput (file);
+
+ down (&shm_ids.sem);
+ if(!(shp = shm_lock(shmid)))
+ BUG();
+ shp->shm_nattch--;
+ if(shp->shm_nattch == 0 &&
+ shp->shm_flags & SHM_DEST)
+ shm_destroy (shp);
+ shm_unlock(shmid);
+ up (&shm_ids.sem);
+
*raddr = (unsigned long) user_addr;
err = 0;
if (IS_ERR(user_addr))
@@ -684,7 +676,7 @@
shp->shm_segsz,
shp->shm_cprid,
shp->shm_lprid,
- file_count (shp->shm_file) - 1,
+ shp->shm_nattch,
shp->shm_perm.uid,
shp->shm_perm.gid,
shp->shm_perm.cuid,
diff -uNr 4-13-3/mm/shmem.c c/mm/shmem.c
--- 4-13-3/mm/shmem.c Mon Dec 18 15:08:32 2000
+++ c/mm/shmem.c Mon Dec 18 15:13:10 2000
@@ -210,37 +210,39 @@
{
int error;
struct shmem_inode_info *info;
- swp_entry_t *entry;
+ swp_entry_t *entry, swap;
info = &((struct inode *)page->mapping->host)->u.shmem_i;
if (info->locked)
return 1;
- spin_lock(&info->lock);
- entry = shmem_swp_entry (info, page->index);
- if (!entry) /* this had been allocted on page allocation */
- BUG();
- error = -EAGAIN;
- if (entry->val)
- goto out;
-
/*
* 1 means "cannot write out".
* We can't drop dirty pages
* just because we ran out of
* swap.
*/
- error = 1;
- *entry = __get_swap_page(2);
- if (!entry->val)
+ swap = __get_swap_page(2);
+ if (!swap.val)
+ return 1;
+
+ spin_lock(&info->lock);
+ entry = shmem_swp_entry (info, page->index);
+ if (!entry) /* this had been allocted on page allocation */
+ BUG();
+ error = -EAGAIN;
+ if (entry->val) {
+ __swap_free(swap, 2);
goto out;
+ }
+ *entry = swap;
error = 0;
/* Remove the from the page cache */
lru_cache_del(page);
remove_inode_page(page);
/* Add it to the swap cache */
- add_to_swap_cache(page,*entry);
+ add_to_swap_cache(page, swap);
page_cache_release(page);
SetPageDirty(page);
info->swapped++;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2000-12-19 1:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-19 0:58 test13-pre3 Dieter Nützel
-- strict thread matches above, loose matches on Subject: below --
2000-12-18 17:35 test13-pre3 Petr Vandrovec
2000-12-18 17:18 ` test13-pre3 Maciej W. Rozycki
2000-12-17 21:55 test13-pre3 Linus Torvalds
2000-12-17 23:43 ` test13-pre3 Albert Cranford
2000-12-18 6:00 ` test13-pre3 Peter Samuelson
2000-12-18 12:58 ` test13-pre3 Maciej W. Rozycki
2000-12-18 14:34 ` test13-pre3 Christoph Rohland
2000-12-18 19:24 ` test13-pre3 Christoph Rohland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox