27 Aug, 2009

1 commit

  • An mlocked page might lose the isolatation race. This causes the page to
    clear PG_mlocked while it remains in a VM_LOCKED vma. This means it can
    be put onto the [in]active list. We can rescue it by using try_to_unmap()
    in shrink_page_list().

    But now, As Wu Fengguang pointed out, vmscan has a bug. If the page has
    PG_referenced, it can't reach try_to_unmap() in shrink_page_list() but is
    put into the active list. If the page is referenced repeatedly, it can
    remain on the [in]active list without being moving to the unevictable
    list.

    This patch fixes it.

    Reported-by: Wu Fengguang
    Signed-off-by: Minchan Kim
    Reviewed-by: KOSAKI Motohiro <
    Cc: Lee Schermerhorn
    Acked-by: Rik van Riel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Minchan Kim
     

19 Aug, 2009

4 commits

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
    percpu: use the right flag for get_vm_area()
    percpu, sparc64: fix sparse possible cpu map handling
    init: set nr_cpu_ids before setup_per_cpu_areas()

    Linus Torvalds
     
  • If node_load[] is cleared everytime build_zonelists() is
    called,node_load[] will have no help to find the next node that should
    appear in the given node's fallback list.

    Because of the bug, zonelist's node_order is not calculated as expected.
    This bug affects on big machine, which has asynmetric node distance.

    [synmetric NUMA's node distance]
    0 1 2
    0 10 12 12
    1 12 10 12
    2 12 12 10

    [asynmetric NUMA's node distance]
    0 1 2
    0 10 12 20
    1 12 10 14
    2 20 14 10

    This (my bug) is very old but no one has reported this for a long time.
    Maybe because the number of asynmetric NUMA is very small and they use
    cpuset for customizing node memory allocation fallback.

    [akpm@linux-foundation.org: fix CONFIG_NUMA=n build]
    Signed-off-by: Bo Liu
    Reviewed-by: KAMEZAWA Hiroyuki
    Cc: Mel Gorman
    Cc: Christoph Lameter
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bo Liu
     
  • According to the POSIX (1003.1-2008), the file descriptor shall have been
    opened with read permission, regardless of the protection options specified to
    mmap(). The ltp test cases mmap06/07 need this.

    Signed-off-by: Graff Yang
    Acked-by: Paul Mundt
    Signed-off-by: David Howells
    Acked-by: Greg Ungerer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Graff Yang
     
  • The commit 2ff05b2b (oom: move oom_adj value) moveed the oom_adj value to
    the mm_struct. It was a very good first step for sanitize OOM.

    However Paul Menage reported the commit makes regression to his job
    scheduler. Current OOM logic can kill OOM_DISABLED process.

    Why? His program has the code of similar to the following.

    ...
    set_oom_adj(OOM_DISABLE); /* The job scheduler never killed by oom */
    ...
    if (vfork() == 0) {
    set_oom_adj(0); /* Invoked child can be killed */
    execve("foo-bar-cmd");
    }
    ....

    vfork() parent and child are shared the same mm_struct. then above
    set_oom_adj(0) doesn't only change oom_adj for vfork() child, it's also
    change oom_adj for vfork() parent. Then, vfork() parent (job scheduler)
    lost OOM immune and it was killed.

    Actually, fork-setting-exec idiom is very frequently used in userland program.
    We must not break this assumption.

    Then, this patch revert commit 2ff05b2b and related commit.

    Reverted commit list
    ---------------------
    - commit 2ff05b2b4e (oom: move oom_adj value from task_struct to mm_struct)
    - commit 4d8b9135c3 (oom: avoid unnecessary mm locking and scanning for OOM_DISABLE)
    - commit 8123681022 (oom: only oom kill exiting tasks with attached memory)
    - commit 933b787b57 (mm: copy over oom_adj value at fork time)

    Signed-off-by: KOSAKI Motohiro
    Cc: Paul Menage
    Cc: David Rientjes
    Cc: KAMEZAWA Hiroyuki
    Cc: Rik van Riel
    Cc: Linus Torvalds
    Cc: Oleg Nesterov
    Cc: Nick Piggin
    Cc: Mel Gorman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     

17 Aug, 2009

1 commit

  • Currently SELinux enforcement of controls on the ability to map low memory
    is determined by the mmap_min_addr tunable. This patch causes SELinux to
    ignore the tunable and instead use a seperate Kconfig option specific to how
    much space the LSM should protect.

    The tunable will now only control the need for CAP_SYS_RAWIO and SELinux
    permissions will always protect the amount of low memory designated by
    CONFIG_LSM_MMAP_MIN_ADDR.

    This allows users who need to disable the mmap_min_addr controls (usual reason
    being they run WINE as a non-root user) to do so and still have SELinux
    controls preventing confined domains (like a web server) from being able to
    map some area of low memory.

    Signed-off-by: Eric Paris
    Signed-off-by: James Morris

    Eric Paris
     

14 Aug, 2009

2 commits

  • get_vm_area() only accepts VM_* flags, not GFP_*.

    And according to the doc of get_vm_area(), here should be
    VM_ALLOC.

    Signed-off-by: WANG Cong
    Acked-by: Tejun Heo
    Cc: Ingo Molnar

    Amerigo Wang
     
  • percpu code has been assuming num_possible_cpus() == nr_cpu_ids which
    is incorrect if cpu_possible_map contains holes. This causes percpu
    code to access beyond allocated memories and vmalloc areas. On a
    sparc64 machine with cpus 0 and 2 (u60), this triggers the following
    warning or fails boot.

    WARNING: at /devel/tj/os/work/mm/vmalloc.c:106 vmap_page_range_noflush+0x1f0/0x240()
    Modules linked in:
    Call Trace:
    [00000000004b17d0] vmap_page_range_noflush+0x1f0/0x240
    [00000000004b1840] map_vm_area+0x20/0x60
    [00000000004b1950] __vmalloc_area_node+0xd0/0x160
    [0000000000593434] deflate_init+0x14/0xe0
    [0000000000583b94] __crypto_alloc_tfm+0xd4/0x1e0
    [00000000005844f0] crypto_alloc_base+0x50/0xa0
    [000000000058b898] alg_test_comp+0x18/0x80
    [000000000058dad4] alg_test+0x54/0x180
    [000000000058af00] cryptomgr_test+0x40/0x60
    [0000000000473098] kthread+0x58/0x80
    [000000000042b590] kernel_thread+0x30/0x60
    [0000000000472fd0] kthreadd+0xf0/0x160
    ---[ end trace 429b268a213317ba ]---

    This patch fixes generic percpu functions and sparc64
    setup_per_cpu_areas() so that they handle sparse cpu_possible_map
    properly.

    Please note that on x86, cpu_possible_map() doesn't contain holes and
    thus num_possible_cpus() == nr_cpu_ids and this patch doesn't cause
    any behavior difference.

    Signed-off-by: Tejun Heo
    Acked-by: David S. Miller
    Cc: Ingo Molnar

    Tejun Heo
     

10 Aug, 2009

1 commit

  • clean up type-casting twice. "size_t" is typedef as "unsigned long" in
    64-bit system, and "unsigned int" in 32-bit system, and the intermediate
    cast to 'long' is pointless.

    Signed-off-by: Figo.zhang
    Signed-off-by: Linus Torvalds

    Figo.zhang
     

08 Aug, 2009

1 commit

  • At first, init_task's mems_allowed is initialized as this.
    init_task->mems_allowed == node_state[N_POSSIBLE]

    And cpuset's top_cpuset mask is initialized as this
    top_cpuset->mems_allowed = node_state[N_HIGH_MEMORY]

    Before 2.6.29:
    policy's mems_allowed is initialized as this.

    1. update tasks->mems_allowed by its cpuset->mems_allowed.
    2. policy->mems_allowed = nodes_and(tasks->mems_allowed, user's mask)

    Updating task's mems_allowed in reference to top_cpuset's one.
    cpuset's mems_allowed is aware of N_HIGH_MEMORY, always.

    In 2.6.30: After commit 58568d2a8215cb6f55caf2332017d7bdff954e1c
    ("cpuset,mm: update tasks' mems_allowed in time"), policy's mems_allowed
    is initialized as this.

    1. policy->mems_allowd = nodes_and(task->mems_allowed, user's mask)

    Here, if task is in top_cpuset, task->mems_allowed is not updated from
    init's one. Assume user excutes command as #numactrl --interleave=all
    ,....

    policy->mems_allowd = nodes_and(N_POSSIBLE, ALL_SET_MASK)

    Then, policy's mems_allowd can includes a possible node, which has no pgdat.

    MPOL's INTERLEAVE just scans nodemask of task->mems_allowd and access this
    directly.

    NODE_DATA(nid)->zonelist even if NODE_DATA(nid)==NULL

    Then, what's we need is making policy->mems_allowed be aware of
    N_HIGH_MEMORY. This patch does that. But to do so, extra nodemask will
    be on statck. Because I know cpumask has a new interface of
    CPUMASK_ALLOC(), I added it to node.

    This patch stands on old behavior. But I feel this fix itself is just a
    Band-Aid. But to do fundametal fix, we have to take care of memory
    hotplug and it takes time. (task->mems_allowd should be N_HIGH_MEMORY, I
    think.)

    mpol_set_nodemask() should be aware of N_HIGH_MEMORY and policy's nodemask
    should be includes only online nodes.

    In old behavior, this is guaranteed by frequent reference to cpuset's
    code. Now, most of them are removed and mempolicy has to check it by
    itself.

    To do check, a few nodemask_t will be used for calculating nodemask. But,
    size of nodemask_t can be big and it's not good to allocate them on stack.

    Now, cpumask_t has CPUMASK_ALLOC/FREE an easy code for get scratch area.
    NODEMASK_ALLOC/FREE shoudl be there.

    [akpm@linux-foundation.org: cleanups & tweaks]
    Tested-by: KOSAKI Motohiro
    Signed-off-by: KAMEZAWA Hiroyuki
    Cc: Miao Xie
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Christoph Lameter
    Cc: Paul Menage
    Cc: Nick Piggin
    Cc: Yasunori Goto
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Lee Schermerhorn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     

30 Jul, 2009

8 commits

  • * 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
    PM / Hibernate: Replace bdget call with simple atomic_inc of i_count
    PM / ACPI: HP G7000 Notebook needs a SCI_EN resume quirk

    Linus Torvalds
     
  • The page allocator warns once when an order >= MAX_ORDER is specified.
    This is to catch callers of the allocator that are always falling back to
    their worst-case when it was not expected. However, there are cases where
    the caller is behaving correctly but cannot suppress the warning. This
    patch allows the warning to be suppressed by the callers by specifying
    __GFP_NOWARN.

    Signed-off-by: Mel Gorman
    Acked-by: David Rientjes
    Cc: Arnaldo Carvalho de Melo
    Cc: "David S. Miller"
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • After commit ec64f51545fffbc4cb968f0cea56341a4b07e85a ("cgroup: fix
    frequent -EBUSY at rmdir"), cgroup's rmdir (especially against memcg)
    doesn't return -EBUSY by temporary ref counts. That commit expects all
    refs after pre_destroy() is temporary but...it wasn't. Then, rmdir can
    wait permanently. This patch tries to fix that and change followings.

    - set CGRP_WAIT_ON_RMDIR flag before pre_destroy().
    - clear CGRP_WAIT_ON_RMDIR flag when the subsys finds racy case.
    if there are sleeping ones, wakes them up.
    - rmdir() sleeps only when CGRP_WAIT_ON_RMDIR flag is set.

    Tested-by: Daisuke Nishimura
    Reported-by: Daisuke Nishimura
    Reviewed-by: Paul Menage
    Acked-by: Balbir Sigh
    Signed-off-by: KAMEZAWA Hiroyuki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     
  • As reported in Red Hat bz #509671, i_blocks for files on hugetlbfs get
    accounting wrong when doing something like:

    $ > foo
    $ date > foo
    date: write error: Invalid argument
    $ /usr/bin/stat foo
    File: `foo'
    Size: 0 Blocks: 18446744073709547520 IO Block: 2097152 regular
    ...

    This is because hugetlb_unreserve_pages() is unconditionally removing
    blocks_per_huge_page(h) on each call rather than using the freed amount.
    If there were 0 blocks, it goes negative, resulting in the above.

    This is a regression from commit a5516438959d90b071ff0a484ce4f3f523dc3152
    ("hugetlb: modular state for hugetlb page size")

    which did:

    - inode->i_blocks -= BLOCKS_PER_HUGEPAGE * freed;
    + inode->i_blocks -= blocks_per_huge_page(h);

    so just put back the freed multiplier, and it's all happy again.

    Signed-off-by: Eric Sandeen
    Acked-by: Andi Kleen
    Cc: William Lee Irwin III
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • If a task is oom killed and still cannot find memory when trying with
    no watermarks, it's better to fail the allocation attempt than to loop
    endlessly. Direct reclaim has already failed and the oom killer will
    be a no-op since current has yet to die, so there is no other
    alternative for allocations that are not __GFP_NOFAIL.

    Acked-by: Mel Gorman
    Signed-off-by: David Rientjes
    Acked-by: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     
  • Fix a post-2.6.24 performace regression caused by
    3dfa5721f12c3d5a441448086bee156887daa961 ("page-allocator: preserve PFN
    ordering when __GFP_COLD is set").

    Narayanan reports "The regression is around 15%. There is no disk controller
    as our setup is based on Samsung OneNAND used as a memory mapped device on a
    OMAP2430 based board."

    The page allocator tries to preserve contiguous PFN ordering when returning
    pages such that repeated callers to the allocator have a strong chance of
    getting physically contiguous pages, particularly when external fragmentation
    is low. However, of the bulk of the allocations have __GFP_COLD set as they
    are due to aio_read() for example, then the PFNs are in reverse PFN order.
    This can cause performance degration when used with IO controllers that could
    have merged the requests.

    This patch attempts to preserve the contiguous ordering of PFNs for users of
    __GFP_COLD.

    Signed-off-by: Mel Gorman
    Reported-by: Narayananu Gopalakrishnan
    Tested-by: Narayanan Gopalakrishnan
    Cc: KAMEZAWA Hiroyuki
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • Objects passed to kmemleak_seq_next() have an incremented reference
    count (hence not freed) but they may point via object_list.next to
    other freed objects. To avoid this, the whole start/next/stop sequence
    must be protected by rcu_read_lock().

    Signed-off-by: Catalin Marinas
    Signed-off-by: Linus Torvalds

    Catalin Marinas
     
  • Create bdgrab(). This function copies an existing reference to a
    block_device. It is safe to call from any context.

    Hibernation code wishes to copy a reference to the active swap device.
    Right now it calls bdget() under a spinlock, but this is wrong because
    bdget() can sleep. It doesn't need a full bdget() because we already
    hold a reference to active swap devices (and the spinlock protects
    against swapoff).

    Fixes http://bugzilla.kernel.org/show_bug.cgi?id=13827

    Signed-off-by: Alan Jenkins
    Signed-off-by: Rafael J. Wysocki

    Alan Jenkins
     

28 Jul, 2009

1 commit

  • mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()

    Upcoming paches to support the new 64-bit "BookE" powerpc architecture
    will need to have the virtual address corresponding to PTE page when
    freeing it, due to the way the HW table walker works.

    Basically, the TLB can be loaded with "large" pages that cover the whole
    virtual space (well, sort-of, half of it actually) represented by a PTE
    page, and which contain an "indirect" bit indicating that this TLB entry
    RPN points to an array of PTEs from which the TLB can then create direct
    entries. Thus, in order to invalidate those when PTE pages are deleted,
    we need the virtual address to pass to tlbilx or tlbivax instructions.

    The old trick of sticking it somewhere in the PTE page struct page sucks
    too much, the address is almost readily available in all call sites and
    almost everybody implemets these as macros, so we may as well add the
    argument everywhere. I added it to the pmd and pud variants for consistency.

    Signed-off-by: Benjamin Herrenschmidt
    Acked-by: David Howells [MN10300 & FRV]
    Acked-by: Nick Piggin
    Acked-by: Martin Schwidefsky [s390]
    Signed-off-by: Linus Torvalds

    Benjamin Herrenschmidt
     

13 Jul, 2009

1 commit

  • * 'kmemleak' of git://linux-arm.org/linux-2.6:
    kmemleak: Remove alloc_bootmem annotations introduced in the past
    kmemleak: Add callbacks to the bootmem allocator
    kmemleak: Allow partial freeing of memory blocks
    kmemleak: Trace the kmalloc_large* functions in slub
    kmemleak: Scan objects allocated during a scanning episode
    kmemleak: Do not acquire scan_mutex in kmemleak_open()
    kmemleak: Remove the reported leaks number limitation
    kmemleak: Add more cond_resched() calls in the scanning thread
    kmemleak: Renice the scanning thread to +10

    Linus Torvalds
     

11 Jul, 2009

1 commit


10 Jul, 2009

1 commit


08 Jul, 2009

6 commits

  • This patch adds kmemleak_alloc/free callbacks to the bootmem allocator.
    This would allow scanning of such blocks and help avoiding a whole class
    of false positives and more kmemleak annotations.

    Signed-off-by: Catalin Marinas
    Cc: Ingo Molnar
    Acked-by: Pekka Enberg
    Reviewed-by: Johannes Weiner

    Catalin Marinas
     
  • Functions like free_bootmem() are allowed to free only part of a memory
    block. This patch adds support for this via the kmemleak_free_part()
    callback which removes the original object and creates one or two
    additional objects as a result of the memory block split.

    Signed-off-by: Catalin Marinas
    Cc: Ingo Molnar
    Acked-by: Pekka Enberg

    Catalin Marinas
     
  • The kmalloc_large() and kmalloc_large_node() functions were missed when
    adding the kmemleak hooks to the slub allocator. However, they should be
    traced to avoid false positives.

    Signed-off-by: Catalin Marinas
    Cc: Christoph Lameter
    Acked-by: Pekka Enberg

    Catalin Marinas
     
  • Many of the false positives in kmemleak happen on busy systems where
    objects are allocated during a kmemleak scanning episode. These objects
    aren't scanned by default until the next memory scan. When such object
    is added, for example, at the head of a list, it is possible that all
    the other objects in the list become unreferenced until the next scan.

    This patch adds checking for newly allocated objects at the end of the
    scan and repeats the scanning on these objects. If Linux allocates
    new objects at a higher rate than their scanning, it stops after a
    predefined number of passes.

    Signed-off-by: Catalin Marinas

    Catalin Marinas
     
  • Initially, the scan_mutex was acquired in kmemleak_open() and released
    in kmemleak_release() (corresponding to /sys/kernel/debug/kmemleak
    operations). This was causing some lockdep reports when the file was
    closed from a different task than the one opening it. This patch moves
    the scan_mutex acquiring in kmemleak_write() or kmemleak_seq_start()
    with releasing in kmemleak_seq_stop().

    Signed-off-by: Catalin Marinas

    Catalin Marinas
     
  • Since the leaks are no longer printed to the syslog, there is no point
    in keeping this limitation. All the suspected leaks are shown on
    /sys/kernel/debug/kmemleak file.

    Signed-off-by: Catalin Marinas

    Catalin Marinas
     

07 Jul, 2009

5 commits

  • Following recent fix to no longer reschedule in the scan_block()
    function, the system may become unresponsive with !PREEMPT. This patch
    re-adds the cond_resched() call to scan_block() but conditioned by the
    allow_resched parameter.

    Signed-off-by: Catalin Marinas
    Cc: Ingo Molnar

    Catalin Marinas
     
  • This is a long-running thread but not high-priority. So it makes sense
    to renice it to +10.

    Signed-off-by: Catalin Marinas

    Catalin Marinas
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6:
    SLAB: Fix lockdep annotations
    fix RCU-callback-after-kmem_cache_destroy problem in sl[aou]b

    Linus Torvalds
     
  • These warnings were observed on MIPS32 using 2.6.31-rc1 and gcc-4.2.0:

    mm/page_alloc.c: In function 'alloc_pages_exact':
    mm/page_alloc.c:1986: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast

    drivers/usb/mon/mon_bin.c: In function 'mon_alloc_buff':
    drivers/usb/mon/mon_bin.c:1264: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast

    [akpm@linux-foundation.org: fix kernel/perf_counter.c too]
    Signed-off-by: Kevin Cernekee
    Cc: Andi Kleen
    Cc: Ralf Baechle
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kevin Cernekee
     
  • In testing a backport of the write_begin/write_end AOPs, a 10% re-read
    regression was noticed when running iozone. This regression was
    introduced because the old AOPs would always do a mark_page_accessed(page)
    after the commit_write, but when the new AOPs where introduced, the only
    place this was kept was in pagecache_write_end().

    This patch does the same thing in the generic case as what is done in
    pagecache_write_end(), which is just to mark the page accessed before we
    do write_end().

    Signed-off-by: Josef Bacik
    Acked-by: Nick Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Josef Bacik
     

06 Jul, 2009

1 commit


02 Jul, 2009

2 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
    sh: LCDC dcache flush for deferred io
    sh: Fix compiler error and include the definition of IS_ERR_VALUE
    sh: re-add LCDC fbdev support to the Migo-R defconfig
    sh: fix se7724 ceu names
    sh: ms7724se: Enable sh_eth in defconfig.
    arch/sh/boards/mach-se/7206/io.c: Remove unnecessary semicolons
    sh: ms7724se: Add sh_eth support
    nommu: provide follow_pfn().
    sh: Kill off unused DEBUG_BOOTMEM symbol.
    perf_counter tools: add cpu_relax()/rmb() definitions for sh.
    sh64: Hook up page fault events for software perf counters.
    sh: Hook up page fault events for software perf counters.
    sh: make set_perf_counter_pending() static inline.
    clocksource: sh_tmu: Make undefined TCOR behaviour less undefined.

    Linus Torvalds
     
  • One of the kmemleak changes caused the following
    scheduling-while-holding-the-tasklist-lock regression on x86:

    BUG: sleeping function called from invalid context at mm/kmemleak.c:795
    in_atomic(): 1, irqs_disabled(): 0, pid: 1737, name: kmemleak
    2 locks held by kmemleak/1737:
    #0: (scan_mutex){......}, at: [] kmemleak_scan_thread+0x45/0x86
    #1: (tasklist_lock){......}, at: [] kmemleak_scan+0x1a9/0x39c
    Pid: 1737, comm: kmemleak Not tainted 2.6.31-rc1-tip #59266
    Call Trace:
    [] ? __debug_show_held_locks+0x1e/0x20
    [] __might_sleep+0x10a/0x111
    [] scan_yield+0x17/0x3b
    [] scan_block+0x39/0xd4
    [] kmemleak_scan+0x1bb/0x39c
    [] ? kmemleak_scan_thread+0x0/0x86
    [] kmemleak_scan_thread+0x4a/0x86
    [] kthread+0x6e/0x73
    [] ? kthread+0x0/0x73
    [] kernel_thread_helper+0x7/0x10
    kmemleak: 834 new suspected memory leaks (see /sys/kernel/debug/kmemleak)

    The bit causing it is highly dubious:

    static void scan_yield(void)
    {
    might_sleep();

    if (time_is_before_eq_jiffies(next_scan_yield)) {
    schedule();
    next_scan_yield = jiffies + jiffies_scan_yield;
    }
    }

    It called deep inside the codepath and in a conditional way,
    and that is what crapped up when one of the new scan_block()
    uses grew a tasklist_lock dependency.

    This minimal patch removes that yielding stuff and adds the
    proper cond_resched().

    The background scanning thread could probably also be reniced
    to +10.

    Signed-off-by: Ingo Molnar
    Acked-by: Pekka Enberg
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

01 Jul, 2009

4 commits

  • * 'kmemleak' of git://linux-arm.org/linux-2.6:
    kmemleak: Inform kmemleak about pid_hash
    kmemleak: Do not warn if an unknown object is freed
    kmemleak: Do not report new leaked objects if the scanning was stopped
    kmemleak: Slightly change the policy on newly allocated objects
    kmemleak: Do not trigger a scan when reading the debug/kmemleak file
    kmemleak: Simplify the reports logged by the scanning thread
    kmemleak: Enable task stacks scanning by default
    kmemleak: Allow the early log buffer to be configurable.

    Linus Torvalds
     
  • Nathan reported that

    | commit 73d60b7f747176dbdff826c4127d22e1fd3f9f74
    | Author: Yinghai Lu
    | Date: Tue Jun 16 15:33:00 2009 -0700
    |
    | page-allocator: clear N_HIGH_MEMORY map before we set it again
    |
    | SRAT tables may contains nodes of very small size. The arch code may
    | decide to not activate such a node. However, currently the early boot
    | code sets N_HIGH_MEMORY for such nodes. These nodes therefore seem to be
    | active although these nodes have no present pages.
    |
    | For 64bit N_HIGH_MEMORY == N_NORMAL_MEMORY, so that works for 64 bit too

    unintentionally and incorrectly clears the cpuset.mems cgroup attribute on
    an i386 kvm guest, meaning that cpuset.mems can not be used.

    Fix this by only clearing node_states[N_NORMAL_MEMORY] for 64bit only.
    and need to do save/restore for that in find_zone_movable_pfn

    Reported-by: Nathan Lynch
    Tested-by: Nathan Lynch
    Signed-off-by: Yinghai Lu
    Cc: Christoph Lameter
    Cc: Ingo Molnar ,
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yinghai Lu
     
  • balance_dirty_pages can overreact and move all of the dirty pages to
    writeback unnecessarily.

    balance_dirty_pages makes its decision to throttle based on the number of
    dirty plus writeback pages that are over the calculated limit,so it will
    continue to move pages even when there are plenty of pages in writeback
    and less than the threshold still dirty.

    This allows it to overshoot its limits and move all the dirty pages to
    writeback while waiting for the drives to catch up and empty the writeback
    list.

    A simple fio test easily demonstrates this problem.

    fio --name=f1 --directory=/disk1 --size=2G -rw=write --name=f2 --directory=/disk2 --size=1G --rw=write --startdelay=10

    This is the simplest fix I could find, but I'm not entirely sure that it
    alone will be enough for all cases. But it certainly is an improvement on
    my desktop machine writing to 2 disks.

    Do we need something more for machines with large arrays where
    bdi_threshold * number_of_drives is greater than the dirty_ratio ?

    Signed-off-by: Richard Kennedy
    Acked-by: Peter Zijlstra
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Richard Kennedy
     
  • show_pools() walks the page_list of a pool w/o protection against the list
    modifications in alloc/free. Take pool->lock to avoid stomping into
    nirvana.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner