Commit 6fb70b47 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.3.41

parent ee226d67
......@@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
......
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
......
......@@ -14,7 +14,6 @@
* for more details.
*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
......
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <asm/dvma.h>
......
......@@ -447,9 +447,6 @@ static inline void attempt_merge (request_queue_t * q,
{
struct request *next = req->next;
if (req->rq_dev == MKDEV(22, 64))
printk("attempt_merge at %lu %lu\n", req->sector, q->current_request->sector);
if (!next)
return;
if (req->sector + req->nr_sectors != next->sector)
......
This diff is collapsed.
......@@ -28,6 +28,7 @@ static const char *cardname = "smctr";
#include <linux/version.h>
#endif
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
......
......@@ -91,7 +91,6 @@
#include <asm/uaccess.h>
#include <linux/if.h>
#include <linux/wanpipe.h>
#include <linux/sdla_ppp.h> /* PPP firmware API definitions */
#include <linux/sdlasfm.h> /* S514 Type Definition */
/****** Defines & Macros ****************************************************/
......
......@@ -84,6 +84,7 @@
#if defined(_LINUX_) /****** Linux *******************************/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/kernel.h> /* printk(), and other useful stuff */
#include <linux/stddef.h> /* offsetof(), etc. */
......
......@@ -22,7 +22,6 @@
* instead. We should discuss this.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
......
......@@ -25,6 +25,7 @@
* Added proper detection of the AHA-1640 (MCA version of AHA-1540)
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
......
......@@ -25,7 +25,6 @@
#include <linux/blk.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
#include "scsi.h"
#include "hosts.h"
......
......@@ -25,7 +25,6 @@
#include <linux/blk.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
#include "scsi.h"
#include "hosts.h"
......
......@@ -28,7 +28,6 @@
#include <linux/blk.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
#include "scsi.h"
#include "hosts.h"
......
......@@ -24,7 +24,6 @@
#include <linux/blk.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
#include "scsi.h"
#include "hosts.h"
......
......@@ -33,7 +33,6 @@
#include <linux/blk.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
#include "scsi.h"
#include "hosts.h"
......
......@@ -495,13 +495,6 @@ probe_scanner(struct usb_device *dev, unsigned int ifnum)
return NULL;
}
ident = kmalloc(256, GFP_KERNEL);
if (ident) {
usb_string(dev, dev->descriptor.iProduct, ident, 256);
info("USB Scanner (%s) found at address %d", ident, dev->devnum);
kfree(ident);
}
hps->present = 1;
hps->hpscan_dev = dev;
......
......@@ -165,6 +165,8 @@ void usb_show_string(struct usb_device *dev, char *id, int index)
{
char *buf;
if (!index)
return;
if (!(buf = kmalloc(256, GFP_KERNEL)))
return;
if (usb_string(dev, index, buf, 256) > 0)
......
......@@ -1579,13 +1579,17 @@ int usb_get_configuration(struct usb_device *dev)
return result;
}
/*
* usb_string:
* returns string length (> 0) or error (< 0)
*/
int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
{
unsigned char *tbuf;
int err;
unsigned int u, idx;
if (size <= 0 || !buf)
if (size <= 0 || !buf || !index)
return -EINVAL;
buf[0] = 0;
tbuf = kmalloc(256, GFP_KERNEL);
......@@ -1602,15 +1606,15 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
err = usb_get_string(dev, dev->string_langid, index, tbuf, tbuf[0]);
if (err < 0)
goto errout;
size--;
for (idx = 0, u = 2; u < tbuf[0]; u += 2) {
size--; /* leave room for trailing NULL char in output buffer */
for (idx = 0, u = 2; u < err; u += 2) {
if (idx >= size)
break;
if (tbuf[u+1]) {
buf[idx++] = '?'; /* non ASCII character */
continue;
}
buf[idx++] = tbuf[u];
if (tbuf[u+1]) /* high byte */
buf[idx++] = '?'; /* non-ASCII character */
else
buf[idx++] = tbuf[u];
}
buf[idx] = 0;
err = idx;
......@@ -1721,9 +1725,12 @@ int usb_new_device(struct usb_device *dev)
info("USB device number %d default language ID 0x%x", dev->devnum, dev->string_langid);
}
usb_show_string(dev, "Manufacturer", dev->descriptor.iManufacturer);
usb_show_string(dev, "Product", dev->descriptor.iProduct);
usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber);
if (dev->descriptor.iManufacturer)
usb_show_string(dev, "Manufacturer", dev->descriptor.iManufacturer);
if (dev->descriptor.iProduct)
usb_show_string(dev, "Product", dev->descriptor.iProduct);
if (dev->descriptor.iSerialNumber)
usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber);
/* now that the basic setup is over, add a /proc/bus/usb entry */
usbdevfs_add_device(dev);
......
......@@ -1264,6 +1264,7 @@ int usb_stor_proc_info (char *buffer, char **start, off_t offset,
SPRINTF("%s\n", tmp_ptr);
else
SPRINTF("Unknown Product\n");
kfree(tmp_ptr);
}
SPRINTF(" Protocol: ");
......@@ -1494,9 +1495,15 @@ static void * storage_probe(struct usb_device *dev, unsigned int ifnum)
/* clear the GUID and fetch the strings */
GUID_CLEAR(guid);
usb_string(dev, dev->descriptor.iManufacturer, mf, sizeof(mf));
usb_string(dev, dev->descriptor.iProduct, prod, sizeof(prod));
usb_string(dev, dev->descriptor.iSerialNumber, serial, sizeof(serial));
memset(mf, 0, sizeof(mf));
memset(prod, 0, sizeof(prod));
memset(serial, 0, sizeof(serial));
if (dev->descriptor.iManufacturer)
usb_string(dev, dev->descriptor.iManufacturer, mf, sizeof(mf));
if (dev->descriptor.iProduct)
usb_string(dev, dev->descriptor.iProduct, prod, sizeof(prod));
if (dev->descriptor.iSerialNumber)
usb_string(dev, dev->descriptor.iSerialNumber, serial, sizeof(serial));
/* let's examine the device now */
......
......@@ -114,7 +114,6 @@ int iso_date(char * p, int flag)
crtime = 0;
} else {
int monlen[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
extern struct timezone sys_tz;
days = year * 365;
if (year > 2)
......
......@@ -1341,7 +1341,7 @@ asmlinkage long sys_rename(const char * oldname, const char * newname)
return error;
}
int vfs_readlink(struct dentry *dentry, char *buffer, int buflen, char *link)
int vfs_readlink(struct dentry *dentry, char *buffer, int buflen, const char *link)
{
u32 len;
......@@ -1359,7 +1359,7 @@ int vfs_readlink(struct dentry *dentry, char *buffer, int buflen, char *link)
static inline struct dentry *
__vfs_follow_link(struct dentry *dentry, struct dentry *base,
unsigned follow, char *link)
unsigned follow, const char *link)
{
struct dentry *result;
UPDATE_ATIME(dentry->d_inode);
......@@ -1377,7 +1377,7 @@ __vfs_follow_link(struct dentry *dentry, struct dentry *base,
struct dentry *
vfs_follow_link(struct dentry *dentry, struct dentry *base,
unsigned int follow, char *link)
unsigned int follow, const char *link)
{
return __vfs_follow_link(dentry,base,follow,link);
}
......
......@@ -306,11 +306,12 @@ asmlinkage long sys_access(const char * filename, int mode)
struct dentry * dentry;
int old_fsuid, old_fsgid;
kernel_cap_t old_cap;
int res = -EINVAL;
int res;
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
lock_kernel();
if (mode != (mode & S_IRWXO)) /* where's F_OK, X_OK, W_OK, R_OK? */
goto out;
old_fsuid = current->fsuid;
old_fsgid = current->fsgid;
old_cap = current->cap_effective;
......@@ -337,7 +338,7 @@ asmlinkage long sys_access(const char * filename, int mode)
current->fsuid = old_fsuid;
current->fsgid = old_fsgid;
current->cap_effective = old_cap;
out:
unlock_kernel();
return res;
}
......
......@@ -61,6 +61,9 @@
# define TIOCM_DSR 0x100
# define TIOCM_CD TIOCM_CAR
# define TIOCM_RI TIOCM_RNG
# define TIOCM_OUT1 0x2000
# define TIOCM_OUT2 0x4000
# define TIOCM_LOOP 0x8000
#define TIOCGSOFTCAR 0x5419
#define TIOCSSOFTCAR 0x541A
......
......@@ -45,6 +45,7 @@ struct termio {
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
......
......@@ -35,6 +35,7 @@ struct termio {
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
......
......@@ -8,7 +8,6 @@
#ifndef _ASM_APOLLO_DMA_H
#define _ASM_APOLLO_DMA_H
#include <linux/config.h>
#include <asm/apollohw.h> /* need byte IO */
#include <asm/spinlock.h> /* And spinlocks */
#include <linux/delay.h>
......
#ifndef _M68K_DMA_H
#define _M68K_DMA_H 1
#include <linux/config.h>
/* it's useless on the m68k, but unfortunately needed by the new
bootmem allocator (but this should do it for this) */
#define MAX_DMA_ADDRESS PAGE_OFFSET
......
......@@ -43,6 +43,9 @@ struct termio {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
......
......@@ -83,6 +83,7 @@ struct termio {
#define TIOCM_DSR 0x400 /* data set ready */
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* line disciplines */
#define N_TTY 0
......
......@@ -166,6 +166,9 @@ struct termio {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
......
......@@ -203,6 +203,9 @@ struct termios {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
......
......@@ -204,6 +204,9 @@ struct termios {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
......
......@@ -24,7 +24,6 @@
#include <linux/types.h>
#include <linux/ioctl.h>
#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/wait.h>
#endif /* __KERNEL__ */
......
......@@ -998,8 +998,8 @@ extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *);
extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *, writepage_t);
extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, read_actor_t);
extern int vfs_readlink(struct dentry *, char *, int, char *);
extern struct dentry *vfs_follow_link(struct dentry *, struct dentry *, unsigned, char *);
extern int vfs_readlink(struct dentry *, char *, int, const char *);
extern struct dentry *vfs_follow_link(struct dentry *, struct dentry *, unsigned, const char *);
extern int page_readlink(struct dentry *, char *, int);
extern struct dentry *page_follow_link(struct dentry *, struct dentry *, unsigned);
......
......@@ -90,7 +90,7 @@ extern struct kernel_param __setup_start, __setup_end;
#define __exit
#define __initdata
#define __exitdata
#define __initcall
#define __initcall(fn)
/* For assembly routines */
#define __INIT
#define __FINIT
......
......@@ -828,6 +828,7 @@
#define PCI_VENDOR_ID_ATT 0x11c1
#define PCI_DEVICE_ID_ATT_L56XMF 0x0440
#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480
#define PCI_VENDOR_ID_SPECIALIX 0x11cb
#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000
......@@ -1019,7 +1020,15 @@
#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a
#define PCI_VENDOR_ID_LAVA 0x1407
#define PCI_DEVICE_ID_LAVA_DUAL_SERIAL 0x0100
#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */
#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */
#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */
#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */
#define PCI_DEVICE_ID_LAVA_QUAD_A 0x0201 /* 2x 16650, half of 4 port */
#define PCI_DEVICE_ID_LAVA_QUAD_B 0x0202 /* 2x 16650, half of 4 port */
#define PCI_DEVICE_ID_LAVA_SSERIAL 0x0500 /* 1x 16550 */
#define PCI_DEVICE_ID_LAVA_PORT_650 0x0600 /* 1x 16650 */
#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000
#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */
#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */
......@@ -1030,6 +1039,8 @@
#define PCI_VENDOR_ID_OXSEMI 0x1415
#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501
#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x950A
#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511
#define PCI_VENDOR_ID_PANACOM 0x14d4
#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
......
......@@ -21,6 +21,7 @@
#ifndef _LINUX_PM_H
#define _LINUX_PM_H
#include <linux/config.h>
#include <linux/list.h>
/*
......
......@@ -37,20 +37,6 @@ struct serial_struct {
#define ASYNC_CLOSING_WAIT_INF 0
#define ASYNC_CLOSING_WAIT_NONE 65535
/*
* The size of the serial xmit buffer is 1 page, or 4096 bytes
*/
#define SERIAL_XMIT_SIZE 4096
/*
* Counters of the input lines (CTS, DSR, RI, CD) interrupts
*/
struct async_icount {
__u32 cts, dsr, rng, dcd, tx, rx;
__u32 frame, parity, overrun, brk;
__u32 buf_overrun;
};
/*
* These are the supported serial types.
*/
......
......@@ -19,11 +19,18 @@
* For definitions of the flags field, see tty.h
*/
#include <linux/config.h>
#include <linux/termios.h>
#include <linux/tqueue.h>
#include <linux/wait.h>
/*
* Counters of the input lines (CTS, DSR, RI, CD) interrupts
*/
struct async_icount {
__u32 cts, dsr, rng, dcd, tx, rx;
__u32 frame, parity, overrun, brk;
__u32 buf_overrun;
};
struct serial_state {
int magic;
......@@ -158,7 +165,7 @@ struct pci_board {
};
struct pci_board_inst {
struct pci_board *board;
struct pci_board board;
struct pci_dev *dev;
};
......@@ -172,7 +179,28 @@ struct pci_board_inst {
#define SPCI_FL_BASE2 0x0002
#define SPCI_FL_BASE3 0x0003
#define SPCI_FL_BASE4 0x0004
#define SPCI_FL_IOMEM 0x0008 /* Use I/O mapped memory */
#define SPCI_FL_BASE_TABLE 0x0010 /* Use base address table for UART */
#define SPCI_FL_GET_BASE(x) (x & SPCI_FL_BASE_MASK)
#define SPCI_FL_IRQ_MASK (0x0007 << 4)
#define SPCI_FL_IRQBASE0 (0x0000 << 4)
#define SPCI_FL_IRQBASE1 (0x0001 << 4)
#define SPCI_FL_IRQBASE2 (0x0002 << 4)
#define SPCI_FL_IRQBASE3 (0x0003 << 4)
#define SPCI_FL_IRQBASE4 (0x0004 << 4)
#define SPCI_FL_GET_IRQBASE(x) ((x & SPCI_FL_IRQ_MASK) >> 4)
/* Use sucessiveentries base resource table */
#define SPCI_FL_BASE_TABLE 0x0100
/* Use successive entries in the irq resource table */
#define SPCI_FL_IRQ_TABLE 0x0200
/* Use the irq resource table instead of dev->irq */
#define SPCI_FL_IRQRESOURCE 0x0400
/* Use the Base address register size to cap number of ports */
#define SPCI_FL_REGION_SZ_CAP 0x0800
#define SPCI_FL_PNPDEFAULT (SPCI_FL_IRQRESOURCE)
#endif /* _LINUX_SERIAL_H */
Started Jan 2000 by Kanoj Sarcar <kanoj@sgi.com>
Memory balancing is needed for non __GFP_WAIT as well as for non
__GFP_IO allocations.
There are two reasons to be requesting non __GFP_WAIT allocations:
the caller can not sleep (typically intr context), or does not want
to incur cost overheads of page stealing and possible swap io for
whatever reasons.
__GFP_IO allocation requests are made to prevent file system deadlocks.
In the absence of non sleepable allocation requests, it seems detrimental
to be doing balancing. Page reclamation can be kicked off lazily, that
is, only when needed (aka zone free memory is 0), instead of making it
a proactive process.
That being said, the kernel should try to fulfill requests for direct
mapped pages from the direct mapped pool, instead of falling back on
the dma pool, so as to keep the dma pool filled for dma requests (atomic
or not). A similar argument applies to highmem and direct mapped pages.
OTOH, if there is a lot of free dma pages, it is preferable to satisfy
regular memory requests by allocating one from the dma pool, instead
of incurring the overhead of regular zone balancing.
In 2.2, memory balancing/page reclamation would kick off only when the
_total_ number of free pages fell below 1/64 th of total memory. With the
right ratio of dma and regular memory, it is quite possible that balancing
would not be done even when the dma zone was completely empty. 2.2 has
been running production machines of varying memory sizes, and seems to be
doing fine even with the presence of this problem. In 2.3, due to
HIGHMEM, this problem is aggravated.
In 2.3, zone balancing can be done in one of two ways: depending on the
zone size (and possibly of the size of lower class zones), we can decide
at init time how many free pages we should aim for while balancing any
zone. The good part is, while balancing, we do not need to look at sizes
of lower class zones, the bad part is, we might do too frequent balancing
due to ignoring possibly lower usage in the lower class zones. Also,
with a slight change in the allocation routine, it is possible to reduce
the memclass() macro to be a simple equality.
Another possible solution is that we balance only when the free memory
of a zone _and_ all its lower class zones falls below 1/64th of the
total memory in the zone and its lower class zones. This fixes the 2.2
balancing problem, and stays as close to 2.2 behavior as possible. Also,
the balancing algorithm works the same way on the various architectures,
which have different numbers and types of zones. If we wanted to get
fancy, we could assign different weights to free pages in different
zones in the future.
Note that if the size of the regular zone is huge compared to dma zone,
it becomes less significant to consider the free dma pages while
deciding whether to balance the regular zone. The first solution
becomes more attractive then.
The appended patch implements the second solution. It also "fixes" two
problems: first, kswapd is woken up as in 2.2 on low memory conditions
for non-sleepable allocations. Second, the HIGHMEM zone is also balanced,
so as to give a fighting chance for replace_with_highmem() to get a
HIGHMEM page, as well as to ensure that HIGHMEM allocations do not
fall back into regular zone. This also makes sure that HIGHMEM pages
are not leaked (for example, in situations where a HIGHMEM page is in
the swapcache but is not being used by anyone)
kswapd also needs to know about the zones it should balance. kswapd is
primarily needed in a situation where balancing can not be done,
probably because all allocation requests are coming from intr context
and all process contexts are sleeping. For 2.3, kswapd does not really
need to balance the highmem zone, since intr context does not request
highmem pages. A zone aware kswapd still needs to be implemented.
Page stealing from process memory and shm is done if stealing the page would
alleviate memory pressure on any zone in the page's node that has fallen below
its watermark.
(Good) Ideas that I have heard:
1. Dynamic experience should influence balancing: number of failed requests
for a zone can be tracked and fed into the balancing scheme (jalvo@mbay.net)
2. Implement a replace_with_highmem()-like replace_with_regular() to preserve
dma pages. (lkd@tantalophile.demon.co.uk)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment