24 Sep, 2009

6 commits

  • * 'sfi-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6:
    SFI: remove unneeded includes
    sfi: Remove unused code
    SFI: Hook PCI MMCONFIG
    x86: add arch-specific SFI support
    SFI: add capability to parse ACPI tables
    SFI: add platform-independent core support
    SFI: create linux/sfi.h
    SFI: Simple Firmware Interface - MAINTAINERS, Kconfig

    Linus Torvalds
     
  • * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (119 commits)
    ACPI: don't pass handle for fixed hardware notifications
    ACPI: remove null pointer checks in deferred execution path
    ACPI: simplify deferred execution path
    acerhdf: additional BIOS versions
    acerhdf: convert to dev_pm_ops
    acerhdf: fix fan control for AOA150 model
    thermal: add missing Kconfig dependency
    acpi: switch /proc/acpi/{debug_layer,debug_level} to seq_file
    hp-wmi: fix rfkill memory leak on unload
    ACPI: remove unnecessary #ifdef CONFIG_DMI
    ACPI: linux/acpi.h should not include linux/dmi.h
    hwmon driver for ACPI 4.0 power meters
    topstar-laptop: add new driver for hotkeys support on Topstar N01
    thinkpad_acpi: fix rfkill memory leak on unload
    thinkpad-acpi: report brightness events when required
    thinkpad-acpi: don't poll by default any of the reserved hotkeys
    thinkpad-acpi: Fix procfs hotkey reset command
    thinkpad-acpi: deprecate hotkey_bios_mask
    thinkpad-acpi: hotkey poll fixes
    thinkpad-acpi: be more strict when detecting a ThinkPad
    ...

    Linus Torvalds
     
  • * 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
    i2c: Clearly mark ACPI drivers as such
    i2c: Add driver for SMBus Control Method Interface
    i2c-pnx: Correct use of request_region/request_mem_region
    MAINTAINERS: Add maintainer for AT24 and PCA9564/PCA9665
    i2c-piix4: Add AMD SB900 SMBus device ID
    i2c/chips: Remove deprecated pcf8574 driver
    i2c/chips: Remove deprecated pca9539 driver
    i2c/chips: Remove deprecated pcf8575 driver
    gpio/pcf857x: Copy i2c_device_id from old pcf8574 driver
    i2c/scx200_acb: Provide more information on bus errors
    i2c: Provide compatibility links for i2c adapters
    i2c: Convert i2c adapters to bus devices
    i2c: Convert i2c clients to a device type
    i2c/tsl2550: Use combined SMBus transactions
    i2c-taos-evm: Switch echo off to improve performance
    i2c: Drop unused i2c_driver.id field

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (142 commits)
    USB: Fix sysfs paths in documentation
    USB: skeleton: fix coding style issues.
    USB: O_NONBLOCK in read path of skeleton
    USB: make usb-skeleton honor O_NONBLOCK in write path
    USB: skel_read really sucks royally
    USB: Add hub descriptor update hook for xHCI
    USB: xhci: Support USB hubs.
    USB: xhci: Set multi-TT field for LS/FS devices under hubs.
    USB: xhci: Set route string for all devices.
    USB: xhci: Fix command wait list handling.
    USB: xhci: Change how xHCI commands are handled.
    USB: xhci: Refactor input device context setup.
    USB: xhci: Endpoint representation refactoring.
    USB: gadget: ether needs to select CRC32
    USB: fix USBTMC get_capabilities success handling
    USB: fix missing error check in probing
    USB: usbfs: add USBDEVFS_URB_BULK_CONTINUATION flag
    USB: support for autosuspend in sierra while online
    USB: ehci-dbgp,ehci: Allow dbpg to work with suspend/resume
    USB: ehci-dbgp,documentation: Documentation updates for ehci-dbgp
    ...

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
    lguest: don't force VIRTIO_F_NOTIFY_ON_EMPTY
    lguest: cleanup for map_switcher()
    lguest: use PGDIR_SHIFT for PAE code to allow different PAGE_OFFSET
    lguest: use set_pte/set_pmd uniformly for real page table entries
    lguest: move panic notifier registration to its expected place.
    virtio_blk: add support for cache flush
    virtio: add virtio IDs file
    virtio: get rid of redundant VIRTIO_ID_9P definition
    virtio: make add_buf return capacity remaining
    virtio_pci: minor MSI-X cleanups

    Linus Torvalds
     
  • For this system call user space passes a signed long length parameter,
    while the kernel side takes an unsigned long parameter and converts it
    later to signed long again.

    This has led to bugs in compat wrappers see e.g. dd90bbd5 "powerpc: Add
    compat_sys_truncate". The s390 compat wrapper for this functions is
    broken as well since it also performs zero extension instead of sign
    extension for the length parameter.

    In addition if hpa comes up with an automated way of generating
    compat wrappers it would generate a wrong one here.

    So change the length parameter from unsigned long to long.

    Cc: "H. Peter Anvin"
    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Heiko Carstens
    Signed-off-by: Linus Torvalds

    Heiko Carstens
     

23 Sep, 2009

34 commits

  • bitfields should be unsigned.

    This fixes sparse noise:
    error: dubious one-bit signed bitfield

    Signed-off-by: H Hartley Sweeten
    Cc: Jan Kara
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    H Hartley Sweeten
     
  • Cc: Eric Miao
    Cc: Russell King
    Cc: David Brownell
    Cc: Samuel Ortiz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marek Vasut
     
  • A GPIO driver for the Freescale MC33880 High/Low side switch

    Signed-off-by: Richard Röjfors
    Cc: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Richard Röjfors
     
  • Commit 926b663ce8215ba448960e1ff6e58b67a2c3b99b (gpiolib: allow GPIOs to
    be named) already provides naming on the chip level. This patch provides
    more flexibility by allowing multiple names where ever in sysfs on a per
    GPIO basis.

    Adapted from David Brownell's comments on a similar concept:
    http://lkml.org/lkml/2009/4/20/203.

    [randy.dunlap@oracle.com: fix build for CONFIG_GENERIC_GPIO=n]
    Signed-off-by: Jani Nikula
    Acked-by: David Brownell
    Cc: Daniel Silverstone
    Signed-off-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jani Nikula
     
  • Support two new half-duplex SPI implementation restrictions, for links
    that talk to TX-only or RX-only devices. (Existing half-duplex flavors
    support both transfer directions, just not at the same time.)

    Move spi_async() into the spi.c core, and stop inlining it. Then make
    that function perform error checks and reject messages that demand more
    than the underlying controller can support.

    Based on a patch from Marek Szyprowski which did this only for the
    bitbanged GPIO driver.

    Cc: Marek Szyprowski
    Signed-off-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     
  • This makes it consistent with other buses (platform, i2c, vio, ...). I'm
    not sure why we use the prefixes, but there must be a reason.

    This was easy enough to do it, and I did it.

    Signed-off-by: Anton Vorontsov
    Cc: David Brownell
    Cc: David Woodhouse
    Cc: Grant Likely
    Cc: Jean Delvare
    Cc: Ben Dooks
    Cc: Benjamin Herrenschmidt
    Cc: Dmitry Torokhov
    Cc: Samuel Ortiz
    Cc: "John W. Linville"
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Anton Vorontsov
     
  • With this patch spi drivers can use standard spi_driver.id_table and
    MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just like
    we do with I2C drivers.

    This is useful when a single driver supports several variants of devices
    but it is not possible to detect them in run-time (like non-JEDEC chips
    probing in drivers/mtd/devices/m25p80.c), and when platform_data usage is
    overkill.

    This patch also makes life a lot easier on OpenFirmware platforms, since
    with OF we extensively use proper device IDs in modaliases.

    Signed-off-by: Anton Vorontsov
    Cc: David Brownell
    Cc: David Woodhouse
    Cc: Grant Likely
    Cc: Jean Delvare
    Cc: Ben Dooks
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Anton Vorontsov
     
  • Add missing kernel-doc notation in spi.h for struct spi_master:

    Warning(include/linux/spi/spi.h:289): No description found for parameter 'mode_bits'
    Warning(include/linux/spi/spi.h:289): No description found for parameter 'flags'

    Signed-off-by: Randy Dunlap
    Acked-by: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     
  • initramfs userspace likes to use this magic number.

    Cc: Hugh Dickins
    Signed-off-by: maximilian attems
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    maximilian attems
     
  • Some archs define MODULED_VADDR/MODULES_END which is not in VMALLOC area.
    This is handled only in x86-64. This patch make it more generic. And we
    can use vread/vwrite to access the area. Fix it.

    Signed-off-by: KAMEZAWA Hiroyuki
    Cc: Jiri Slaby
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     
  • Benjamin Herrenschmidt pointed out that vmemmap
    range is not included in KCORE_RAM, KCORE_VMALLOC ....

    This adds KCORE_VMEMMAP if SPARSEMEM_VMEMMAP is used. By this, vmemmap
    can be readable via /proc/kcore

    Because it's not vmalloc area, vread/vwrite cannot be used. But the range
    is static against the memory layout, this patch handles vmemmap area by
    the same scheme with physical memory.

    This patch assumes SPARSEMEM_VMEMMAP range is not in VMALLOC range. It's
    correct now.

    [akpm@linux-foundation.org: fix typo]
    Signed-off-by: KAMEZAWA Hiroyuki
    Cc: Jiri Slaby
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: WANG Cong
    Cc: Benjamin Herrenschmidt
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     
  • Originally, walk_memory_resource() was introduced to traverse all memory
    of "System RAM" for detecting memory hotplug/unplug range. For doing so,
    flags of IORESOUCE_MEM|IORESOURCE_BUSY was used and this was enough for
    memory hotplug.

    But for using other purpose, /proc/kcore, this may includes some firmware
    area marked as IORESOURCE_BUSY | IORESOUCE_MEM. This patch makes the
    check strict to find out busy "System RAM".

    Note: PPC64 keeps their own walk_memory_resouce(), which walk through
    ppc64's lmb informaton. Because old kclist_add() is called per lmb, this
    patch makes no difference in behavior, finally.

    And this patch removes CONFIG_MEMORY_HOTPLUG check from this function.
    Because pfn_valid() just show "there is memmap or not* and cannot be used
    for "there is physical memory or not", this function is useful in generic
    to scan physical memory range.

    Signed-off-by: KAMEZAWA Hiroyuki
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: WANG Cong
    Cc: Américo Wang
    Cc: David Rientjes
    Cc: Roland Dreier
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     
  • Presently, kclist_add() only eats start address and size as its arguments.
    Considering to make kclist dynamically reconfigulable, it's necessary to
    know which kclists are for System RAM and which are not.

    This patch add kclist types as
    KCORE_RAM
    KCORE_VMALLOC
    KCORE_TEXT
    KCORE_OTHER

    This "type" is used in a patch following this for detecting KCORE_RAM.

    Signed-off-by: KAMEZAWA Hiroyuki
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     
  • This patchset is for /proc/kcore. With this,

    - many per-arch hooks are removed.

    - /proc/kcore will know really valid physical memory area.

    - /proc/kcore will be aware of memory hotplug.

    - /proc/kcore will be architecture independent i.e.
    if an arch supports CONFIG_MMU, it can use /proc/kcore.
    (if the arch uses usual memory layout.)

    This patch:

    /proc/kcore uses its own list handling codes. It's better to use
    generic list codes.

    No changes in logic. just clean up.

    Signed-off-by: KAMEZAWA Hiroyuki
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     
  • A patch to give a better overview of the userland application stack usage,
    especially for embedded linux.

    Currently you are only able to dump the main process/thread stack usage
    which is showed in /proc/pid/status by the "VmStk" Value. But you get no
    information about the consumed stack memory of the the threads.

    There is an enhancement in the /proc//{task/*,}/*maps and which marks
    the vm mapping where the thread stack pointer reside with "[thread stack
    xxxxxxxx]". xxxxxxxx is the maximum size of stack. This is a value
    information, because libpthread doesn't set the start of the stack to the
    top of the mapped area, depending of the pthread usage.

    A sample output of /proc//task//maps looks like:

    08048000-08049000 r-xp 00000000 03:00 8312 /opt/z
    08049000-0804a000 rw-p 00001000 03:00 8312 /opt/z
    0804a000-0806b000 rw-p 00000000 00:00 0 [heap]
    a7d12000-a7d13000 ---p 00000000 00:00 0
    a7d13000-a7f13000 rw-p 00000000 00:00 0 [thread stack: 001ff4b4]
    a7f13000-a7f14000 ---p 00000000 00:00 0
    a7f14000-a7f36000 rw-p 00000000 00:00 0
    a7f36000-a8069000 r-xp 00000000 03:00 4222 /lib/libc.so.6
    a8069000-a806b000 r--p 00133000 03:00 4222 /lib/libc.so.6
    a806b000-a806c000 rw-p 00135000 03:00 4222 /lib/libc.so.6
    a806c000-a806f000 rw-p 00000000 00:00 0
    a806f000-a8083000 r-xp 00000000 03:00 14462 /lib/libpthread.so.0
    a8083000-a8084000 r--p 00013000 03:00 14462 /lib/libpthread.so.0
    a8084000-a8085000 rw-p 00014000 03:00 14462 /lib/libpthread.so.0
    a8085000-a8088000 rw-p 00000000 00:00 0
    a8088000-a80a4000 r-xp 00000000 03:00 8317 /lib/ld-linux.so.2
    a80a4000-a80a5000 r--p 0001b000 03:00 8317 /lib/ld-linux.so.2
    a80a5000-a80a6000 rw-p 0001c000 03:00 8317 /lib/ld-linux.so.2
    afaf5000-afb0a000 rw-p 00000000 00:00 0 [stack]
    ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]

    Also there is a new entry "stack usage" in /proc//{task/*,}/status
    which will you give the current stack usage in kb.

    A sample output of /proc/self/status looks like:

    Name: cat
    State: R (running)
    Tgid: 507
    Pid: 507
    .
    .
    .
    CapBnd: fffffffffffffeff
    voluntary_ctxt_switches: 0
    nonvoluntary_ctxt_switches: 0
    Stack usage: 12 kB

    I also fixed stack base address in /proc//{task/*,}/stat to the base
    address of the associated thread stack and not the one of the main
    process. This makes more sense.

    [akpm@linux-foundation.org: fs/proc/array.c now needs walk_page_range()]
    Signed-off-by: Stefani Seibold
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Alexey Dobriyan
    Cc: "Eric W. Biederman"
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     
  • Especially with the PM framework, those are quite handy to have in driver
    code too.

    Signed-off-by: Nicolas Pitre
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicolas Pitre
     
  • Normally writes to SDIO function 0 outside the vendor specific CCCR
    registers are prohibited.

    To support embedded devices that require writes to SDIO function 0 outside
    this range (e.g. TI WL127x embedded sdio wifi device),
    MMC_QUIRK_LENIENT_FN0 is introduced.

    A card quirks field is added to `struct mmc_card' to support non-standard
    devices (e.g. embedded sdio devices).

    [akpm@linux-foundation.org: code in C, not cpp!]
    Signed-off-by: Ohad Ben-Cohen
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ohad Ben-Cohen
     
  • Add support to disconnect the pull-up resistor on CD/DAT[3] (pin 1)
    of the card. This may be desired on certain setups of boards,
    controllers and embedded sdio devices which do not need the card's
    pull-up. As a result, card detection is disabled and power is saved.

    [akpm@linux-foundation.org: simplify sdio_disable_cd() a bit]
    Signed-off-by: Ohad Ben-Cohen
    Acked-by: Matt Fleming
    Cc: Ian Molton
    Cc: "Roberto A. Foglietta"
    Cc: Philip Langdale
    Cc: Pierre Ossman
    Cc: David Vrabel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ohad Ben-Cohen
     
  • According to the standard, the SWITCH command should be followed by a
    SEND_STATUS command to check for errors.

    Signed-off-by: Adrian Hunter
    Acked-by: Matt Fleming
    Cc: Ian Molton
    Cc: "Roberto A. Foglietta"
    Cc: Jarkko Lavinen
    Cc: Denis Karpov
    Cc: Pierre Ossman
    Cc: Philip Langdale
    Cc: "Madhusudhan"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Hunter
     
  • Add support for the new MMC command SLEEP_AWAKE.

    Signed-off-by: Jarkko Lavinen
    Signed-off-by: Adrian Hunter
    Acked-by: Matt Fleming
    Cc: Ian Molton
    Cc: "Roberto A. Foglietta"
    Cc: Jarkko Lavinen
    Cc: Denis Karpov
    Cc: Pierre Ossman
    Cc: Philip Langdale
    Cc: "Madhusudhan"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jarkko Lavinen
     
  • Power can be saved by powering off cards that are not in use. This is
    similar to suspend / resume except it is under the control of the driver,
    and does not require any power management support. It can only be used
    when the driver can monitor whether the card is removed, otherwise it is
    unsafe. This is possible because, unlike suspend, the driver still
    receives card detect and / or cover switch interrupts.

    Signed-off-by: Adrian Hunter
    Acked-by: Matt Fleming
    Cc: Ian Molton
    Cc: "Roberto A. Foglietta"
    Cc: Jarkko Lavinen
    Cc: Denis Karpov
    Cc: Pierre Ossman
    Cc: Philip Langdale
    Cc: "Madhusudhan"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Hunter
     
  • eMMC's are not removable, so unsafe resume is OK always.

    To permit this a new host capability MMC_CAP_NONREMOVABLE has been added
    and suspend / resume updated accordingly.

    Signed-off-by: Adrian Hunter
    Acked-by: Matt Fleming
    Cc: Ian Molton
    Cc: "Roberto A. Foglietta"
    Cc: Jarkko Lavinen
    Cc: Denis Karpov
    Cc: Pierre Ossman
    Cc: Philip Langdale
    Cc: "Madhusudhan"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Hunter
     
  • This change allows the MMC host to be claimed in situations where the host
    may or may not have already been claimed. Also 'mmc_try_claim_host()' is
    now exported.

    Signed-off-by: Adrian Hunter
    Acked-by: Matt Fleming
    Cc: Ian Molton
    Cc: "Roberto A. Foglietta"
    Cc: Jarkko Lavinen
    Cc: Denis Karpov
    Cc: Pierre Ossman
    Cc: Philip Langdale
    Cc: "Madhusudhan"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Hunter
     
  • MMC hosts that support power saving can use the 'enable' and 'disable'
    methods to exit and enter power saving states. An explanation of their
    use is provided in the comments added to include/linux/mmc/host.h.

    Signed-off-by: Adrian Hunter
    Acked-by: Matt Fleming
    Cc: Ian Molton
    Cc: "Roberto A. Foglietta"
    Cc: Jarkko Lavinen
    Cc: Denis Karpov
    Cc: Pierre Ossman
    Cc: Philip Langdale
    Cc: "Madhusudhan"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Hunter
     
  • Make ->ru_maxrss value in struct rusage filled accordingly to rss hiwater
    mark. This struct is filled as a parameter to getrusage syscall.
    ->ru_maxrss value is set to KBs which is the way it is done in BSD
    systems. /usr/bin/time (gnu time) application converts ->ru_maxrss to KBs
    which seems to be incorrect behavior. Maintainer of this util was
    notified by me with the patch which corrects it and cc'ed.

    To make this happen we extend struct signal_struct by two fields. The
    first one is ->maxrss which we use to store rss hiwater of the task. The
    second one is ->cmaxrss which we use to store highest rss hiwater of all
    task childs. These values are used in k_getrusage() to actually fill
    ->ru_maxrss. k_getrusage() uses current rss hiwater value directly if mm
    struct exists.

    Note:
    exec() clear mm->hiwater_rss, but doesn't clear sig->maxrss.
    it is intetionally behavior. *BSD getrusage have exec() inheriting.

    test programs
    ========================================================

    getrusage.c
    ===========
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include

    #include "common.h"

    #define err(str) perror(str), exit(1)

    int main(int argc, char** argv)
    {
    int status;

    printf("allocate 100MB\n");
    consume(100);

    printf("testcase1: fork inherit? \n");
    printf(" expect: initial.self ~= child.self\n");
    show_rusage("initial");
    if (__fork()) {
    wait(&status);
    } else {
    show_rusage("fork child");
    _exit(0);
    }
    printf("\n");

    printf("testcase2: fork inherit? (cont.) \n");
    printf(" expect: initial.children ~= 100MB, but child.children = 0\n");
    show_rusage("initial");
    if (__fork()) {
    wait(&status);
    } else {
    show_rusage("child");
    _exit(0);
    }
    printf("\n");

    printf("testcase3: fork + malloc \n");
    printf(" expect: child.self ~= initial.self + 50MB\n");
    show_rusage("initial");
    if (__fork()) {
    wait(&status);
    } else {
    printf("allocate +50MB\n");
    consume(50);
    show_rusage("fork child");
    _exit(0);
    }
    printf("\n");

    printf("testcase4: grandchild maxrss\n");
    printf(" expect: post_wait.children ~= 300MB\n");
    show_rusage("initial");
    if (__fork()) {
    wait(&status);
    show_rusage("post_wait");
    } else {
    system("./child -n 0 -g 300");
    _exit(0);
    }
    printf("\n");

    printf("testcase5: zombie\n");
    printf(" expect: pre_wait ~= initial, IOW the zombie process is not accounted.\n");
    printf(" post_wait ~= 400MB, IOW wait() collect child's max_rss. \n");
    show_rusage("initial");
    if (__fork()) {
    sleep(1); /* children become zombie */
    show_rusage("pre_wait");
    wait(&status);
    show_rusage("post_wait");
    } else {
    system("./child -n 400");
    _exit(0);
    }
    printf("\n");

    printf("testcase6: SIG_IGN\n");
    printf(" expect: initial ~= after_zombie (child's 500MB alloc should be ignored).\n");
    show_rusage("initial");
    signal(SIGCHLD, SIG_IGN);
    if (__fork()) {
    sleep(1); /* children become zombie */
    show_rusage("after_zombie");
    } else {
    system("./child -n 500");
    _exit(0);
    }
    printf("\n");
    signal(SIGCHLD, SIG_DFL);

    printf("testcase7: exec (without fork) \n");
    printf(" expect: initial ~= exec \n");
    show_rusage("initial");
    execl("./child", "child", "-v", NULL);

    return 0;
    }

    child.c
    =======
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include

    #include "common.h"

    int main(int argc, char** argv)
    {
    int status;
    int c;
    long consume_size = 0;
    long grandchild_consume_size = 0;
    int show = 0;

    while ((c = getopt(argc, argv, "n:g:v")) != -1) {
    switch (c) {
    case 'n':
    consume_size = atol(optarg);
    break;
    case 'v':
    show = 1;
    break;
    case 'g':

    grandchild_consume_size = atol(optarg);
    break;
    default:
    break;
    }
    }

    if (show)
    show_rusage("exec");

    if (consume_size) {
    printf("child alloc %ldMB\n", consume_size);
    consume(consume_size);
    }

    if (grandchild_consume_size) {
    if (fork()) {
    wait(&status);
    } else {
    printf("grandchild alloc %ldMB\n", grandchild_consume_size);
    consume(grandchild_consume_size);

    exit(0);
    }
    }

    return 0;
    }

    common.c
    ========
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include

    #include "common.h"
    #define err(str) perror(str), exit(1)

    void show_rusage(char *prefix)
    {
    int err, err2;
    struct rusage rusage_self;
    struct rusage rusage_children;

    printf("%s: ", prefix);
    err = getrusage(RUSAGE_SELF, &rusage_self);
    if (!err)
    printf("self %ld ", rusage_self.ru_maxrss);
    err2 = getrusage(RUSAGE_CHILDREN, &rusage_children);
    if (!err2)
    printf("children %ld ", rusage_children.ru_maxrss);

    printf("\n");
    }

    /* Some buggy OS need this worthless CPU waste. */
    void make_pagefault(void)
    {
    void *addr;
    int size = getpagesize();
    int i;

    for (i=0; i
    Signed-off-by: KOSAKI Motohiro
    Cc: Oleg Nesterov
    Cc: Hugh Dickins
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiri Pirko
     
  • abs() will truncate the input if is it outside the 2^32 range. Fix that
    by assuming `long' input.

    This might generate worse code in the common case.

    Signed-off-by: Rolf Eike Beer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rolf Eike Beer
     
  • Split the anonfd interface into a bare file pointer creation one, and a
    file pointer creation plus install one.

    There are cases, like the usage of eventfds inside other kernel
    interfaces, where the file pointer created by anonfd needs to be used
    inside the initialization of other structures.

    As it is right now, as soon as anon_inode_getfd() returns, the kenrle can
    race with userspace closing the newly installed file descriptor.

    This patch, while keeping the old anon_inode_getfd(), introduces a new
    anon_inode_getfile() (whose services are reused in anon_inode_getfd())
    that allows to split the file creation phase and the fd install one.

    Once all the kernel structures are initialized, the code can call the
    proper fd_install().

    Gregory manifested the need for something like this inside KVM.

    Signed-off-by: Davide Libenzi
    Cc: Alexander Viro
    Cc: James Morris
    Cc: Peter Zijlstra
    Cc: Gregory Haskins
    Acked-by: Serge Hallyn
    Acked-by: Roland Dreier
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davide Libenzi
     
  • gcc permitting variable length arrays makes the current construct used for
    BUILD_BUG_ON() useless, as that doesn't produce any diagnostic if the
    controlling expression isn't really constant. Instead, this patch makes
    it so that a bit field gets used here. Consequently, those uses where the
    condition isn't really constant now also need fixing.

    Note that in the gfp.h, kmemcheck.h, and virtio_config.h cases
    MAYBE_BUILD_BUG_ON() really just serves documentation purposes - even if
    the expression is compile time constant (__builtin_constant_p() yields
    true), the array is still deemed of variable length by gcc, and hence the
    whole expression doesn't have the intended effect.

    [akpm@linux-foundation.org: make arch/sparc/include/asm/vio.h compile]
    [akpm@linux-foundation.org: more nonsensical assertions in tpm.c..]
    Signed-off-by: Jan Beulich
    Cc: Andi Kleen
    Cc: Rusty Russell
    Cc: Catalin Marinas
    Cc: "David S. Miller"
    Cc: Rajiv Andrade
    Cc: Mimi Zohar
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Beulich
     
  • Using the type bool (instead of int) for the __print_once flag in the
    printk_once() macro matches the intent of the code better, and allows the
    compiler to generate smaller code; eg a typical callsite with gcc 4.3.3 on
    i386:

    add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6 (-6)
    function old new delta
    static.__print_once 4 1 -3
    get_cpu_vendor 146 143 -3

    Saving 6 bytes of object size per callsite by slightly improving the
    readability of the source seems like a win to me.

    Signed-off-by: Roland Dreier
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roland Dreier
     
  • The act of a process becoming a session leader is a useful signal to a
    supervising init daemon such as Upstart.

    While a daemon will normally do this as part of the process of becoming a
    daemon, it is rare for its children to do so. When the children do, it is
    nearly always a sign that the child should be considered detached from the
    parent and not supervised along with it.

    The poster-child example is OpenSSH; the per-login children call setsid()
    so that they may control the pty connected to them. If the primary daemon
    dies or is restarted, we do not want to consider the per-login children
    and want to respawn the primary daemon without killing the children.

    This patch adds a new PROC_SID_EVENT and associated structure to the
    proc_event event_data union, it arranges for this to be emitted when the
    special PIDTYPE_SID pid is set.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Scott James Remnant
    Acked-by: Matt Helsley
    Cc: Oleg Nesterov
    Cc: Evgeniy Polyakov
    Acked-by: "David S. Miller"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Scott James Remnant
     
  • Make all seq_operations structs const, to help mitigate against
    revectoring user-triggerable function pointers.

    This is derived from the grsecurity patch, although generated from scratch
    because it's simpler than extracting the changes from there.

    Signed-off-by: James Morris
    Acked-by: Serge Hallyn
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    James Morris
     
  • This patch can remove spinlock from struct call_function_data, the
    reasons are below:

    1: add a new interface for cpumask named cpumask_test_and_clear_cpu(),
    it can atomically test and clear specific cpu, we can use it instead
    of cpumask_test_cpu() and cpumask_clear_cpu() and no need data->lock
    to protect those in generic_smp_call_function_interrupt().

    2: in smp_call_function_many(), after csd_lock() return, the current's
    cfd_data is deleted from call_function list, so it not have race
    between other cpus, then cfs_data is only used in
    smp_call_function_many() that must disable preemption and not from
    a hardware interrupthandler or from a bottom half handler to call,
    only the correspond cpu can use it, so it not have race in current
    cpu, no need cfs_data->lock to protect it.

    3: after 1 and 2, cfs_data->lock is only use to protect cfs_data->refs in
    generic_smp_call_function_interrupt(), so we can define cfs_data->refs
    to atomic_t, and no need cfs_data->lock any more.

    Signed-off-by: Xiao Guangrong
    Cc: Ingo Molnar
    Cc: Jens Axboe
    Cc: Nick Piggin
    Cc: Peter Zijlstra
    Acked-by: Rusty Russell
    [akpm@linux-foundation.org: use atomic_dec_return()]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Xiao Guangrong
     
  • Move various magic-number definitions into magic.h.

    Signed-off-by: Nick Black
    Acked-by: Pekka Enberg
    Cc: Al Viro
    Cc: "David S. Miller"
    Cc: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Black
     
  • When syslog is not possible, at the same time there's no serial/net
    console available, it will be hard to read the printk messages. For
    example oops/panic/warning messages in shutdown phase.

    Add a printk delay feature, we can make each printk message delay some
    milliseconds.

    Setting the delay by proc/sysctl interface: /proc/sys/kernel/printk_delay

    The value range from 0 - 10000, default value is 0

    [akpm@linux-foundation.org: fix a few things]
    Signed-off-by: Dave Young
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Young