24 May, 2016

1 commit

  • Currently the size of "struct signal_struct"->oom_flags member is
    sizeof(unsigned) bytes, but only one flag OOM_FLAG_ORIGIN which is
    updated by current thread is defined. We can convert OOM_FLAG_ORIGIN
    into a bool, and reuse the saved bytes for updating from the OOM killer
    and/or the OOM reaper thread.

    By the way, do we care about a race window between run_store() and
    swapoff() because it would be theoretically possible that two threads
    sharing the "struct signal_struct" concurrently call respective
    functions? If we care, we can make oom_flags an atomic_t.

    Signed-off-by: Tetsuo Handa
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tetsuo Handa
     

25 Nov, 2015

1 commit

  • As reported by Michal Simek, building an ARM64 kernel with CONFIG_UID16
    disabled currently fails because the system call table still needs to
    reference the individual function entry points that are provided by
    kernel/sys_ni.c in this case, and the declarations are hidden inside
    of #ifdef CONFIG_UID16:

    arch/arm64/include/asm/unistd32.h:57:8: error: 'sys_lchown16' undeclared here (not in a function)
    __SYSCALL(__NR_lchown, sys_lchown16)

    I believe this problem only exists on ARM64, because older architectures
    tend to not need declarations when their system call table is built
    in assembly code, while newer architectures tend to not need UID16
    support. ARM64 only uses these system calls for compatibility with
    32-bit ARM binaries.

    This changes the CONFIG_UID16 check into CONFIG_HAVE_UID16, which is
    set unconditionally on ARM64 with CONFIG_COMPAT, so we see the
    declarations whenever we need them, but otherwise the behavior is
    unchanged.

    Fixes: af1839eb4bd4 ("Kconfig: clean up the long arch list for the UID16 config option")
    Signed-off-by: Arnd Bergmann
    Acked-by: Will Deacon
    Cc: stable@vger.kernel.org
    Signed-off-by: Catalin Marinas

    Arnd Bergmann
     

06 Nov, 2015

1 commit

  • Make struct callback_head aligned to size of pointer. On most
    architectures it happens naturally due ABI requirements, but some
    architectures (like CRIS) have weird ABI and we need to ask it explicitly.

    The alignment is required to guarantee that bits 0 and 1 of @next will be
    clear under normal conditions -- as long as we use call_rcu(),
    call_rcu_bh(), call_rcu_sched(), or call_srcu() to queue callback.

    This guarantee is important for few reasons:
    - future call_rcu_lazy() will make use of lower bits in the pointer;
    - the structure shares storage spacer in struct page with @compound_head,
    which encode PageTail() in bit 0. The guarantee is needed to avoid
    false-positive PageTail().

    False postive PageTail() caused crash on crisv32[1]. It happend due
    misaligned task_struct->rcu, which was byte-aligned.

    [1] http://lkml.kernel.org/r/55FAEA67.9000102@roeck-us.net

    Signed-off-by: Kirill A. Shutemov
    Reported-by: Guenter Roeck
    Tested-by: Guenter Roeck
    Acked-by: Paul E. McKenney
    Cc: Mikael Starvik
    Cc: Jesper Nilsson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

23 Jul, 2015

1 commit

  • There have been several requests for a primitive that waits for
    grace periods for several RCU flavors concurrently, so this
    commit creates it. This is a variadic macro, and you pass in
    the call_rcu() functions of the flavors of RCU that you wish to
    wait for.

    Note that you cannot pass in call_srcu() for two reasons: (1) This
    would result in a type mismatch and (2) You need to specify which
    srcu_struct you want to use. Handle this by creating a wrapper
    function for your SRCU domain, for example:

    void call_srcu_mine(struct rcu_head *head, rcu_callback_t func)
    {
    call_srcu(&ss_mine, head, func);
    }

    You can then do something like this:

    synchronize_rcu_mult(call_srcu_mine, call_rcu, call_rcu_sched);

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

30 May, 2015

1 commit

  • David Ahern reported that d63e2e1f3df9 ("sparc/PCI: Clip bridge windows
    to fit in upstream windows") fails to boot on sparc/T5-8:

    pci 0000:06:00.0: reg 0x184: can't handle BAR above 4GB (bus address 0x110204000)

    The problem is that sparc64 assumed that dma_addr_t only needed to hold DMA
    addresses, i.e., bus addresses returned via the DMA API (dma_map_single(),
    etc.), while the PCI core assumed dma_addr_t could hold *any* bus address,
    including raw BAR values. On sparc64, all DMA addresses fit in 32 bits, so
    dma_addr_t is a 32-bit type. However, BAR values can be 64 bits wide, so
    they don't fit in a dma_addr_t. d63e2e1f3df9 added new checking that
    tripped over this mismatch.

    Add pci_bus_addr_t, which is wide enough to hold any PCI bus address,
    including both raw BAR values and DMA addresses. This will be 64 bits
    on 64-bit platforms and on platforms with a 64-bit dma_addr_t. Then
    dma_addr_t only needs to be wide enough to hold addresses from the DMA API.

    [bhelgaas: changelog, bugzilla, Kconfig to ensure pci_bus_addr_t is at
    least as wide as dma_addr_t, documentation]
    Fixes: d63e2e1f3df9 ("sparc/PCI: Clip bridge windows to fit in upstream windows")
    Fixes: 23b13bc76f35 ("PCI: Fail safely if we can't handle BARs larger than 4GB")
    Link: http://lkml.kernel.org/r/CAE9FiQU1gJY1LYrxs+ma5LCTEEe4xmtjRG0aXJ9K_Tsu+m9Wuw@mail.gmail.com
    Link: http://lkml.kernel.org/r/1427857069-6789-1-git-send-email-yinghai@kernel.org
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=96231
    Reported-by: David Ahern
    Tested-by: David Ahern
    Signed-off-by: Yinghai Lu
    Signed-off-by: Bjorn Helgaas
    Acked-by: David S. Miller
    CC: stable@vger.kernel.org # v3.19+

    Yinghai Lu
     

16 Apr, 2015

1 commit

  • Commit 607ca46e97a1 ("UAPI: (Scripted) Disintegrate include/linux") left
    behind some empty conditional blocks. Since they are useless and may
    cause a reader to wonder whether something is missing, remove them.

    Signed-off-by: Rasmus Villemoes
    Cc: Geert Uytterhoeven
    Cc: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     

13 Feb, 2015

1 commit


31 Dec, 2014

1 commit


21 May, 2014

1 commit

  • The DMA-API documentation sometimes refers to "physical addresses" when it
    really means "bus addresses." Sometimes these are identical, but they may
    be different if the bridge leading to the bus performs address translation.
    Update the documentation to use "bus address" when appropriate.

    Also, consistently capitalize "DMA", use parens with function names, use
    dev_printk() in examples, and reword a few sections for clarity.

    No functional change; documentation changes only.

    Signed-off-by: Bjorn Helgaas
    Acked-by: Greg Kroah-Hartman
    Acked-by: Arnd Bergmann
    Acked-by: James Bottomley
    Acked-by: Randy Dunlap

    Bjorn Helgaas
     

12 Dec, 2012

1 commit

  • test_set_oom_score_adj() and compare_swap_oom_score_adj() are used to
    specify that current should be killed first if an oom condition occurs in
    between the two calls.

    The usage is

    short oom_score_adj = test_set_oom_score_adj(OOM_SCORE_ADJ_MAX);
    ...
    compare_swap_oom_score_adj(OOM_SCORE_ADJ_MAX, oom_score_adj);

    to store the thread's oom_score_adj, temporarily change it to the maximum
    score possible, and then restore the old value if it is still the same.

    This happens to still be racy, however, if the user writes
    OOM_SCORE_ADJ_MAX to /proc/pid/oom_score_adj in between the two calls.
    The compare_swap_oom_score_adj() will then incorrectly reset the old value
    prior to the write of OOM_SCORE_ADJ_MAX.

    To fix this, introduce a new oom_flags_t member in struct signal_struct
    that will be used for per-thread oom killer flags. KSM and swapoff can
    now use a bit in this member to specify that threads should be killed
    first in oom conditions without playing around with oom_score_adj.

    This also allows the correct oom_score_adj to always be shown when reading
    /proc/pid/oom_score.

    Signed-off-by: David Rientjes
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Reviewed-by: Michal Hocko
    Cc: Anton Vorontsov
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     

13 Oct, 2012

1 commit


23 Jul, 2012

1 commit


31 May, 2012

1 commit


11 Apr, 2012

1 commit

  • It makes no sense to export this trivial function. Make it a static inline
    instead.

    This patch also drops virq_to_hw from arch/c6x since it is unused by that
    architecture.

    v2: Move irq_hw_number_t into types.h to fix ARM build failure

    Signed-off-by: Grant Likely
    Acked-by: Thomas Gleixner
    Cc: Benjamin Herrenschmidt

    Grant Likely
     

09 Jan, 2012

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (53 commits)
    Kconfig: acpi: Fix typo in comment.
    misc latin1 to utf8 conversions
    devres: Fix a typo in devm_kfree comment
    btrfs: free-space-cache.c: remove extra semicolon.
    fat: Spelling s/obsolate/obsolete/g
    SCSI, pmcraid: Fix spelling error in a pmcraid_err() call
    tools/power turbostat: update fields in manpage
    mac80211: drop spelling fix
    types.h: fix comment spelling for 'architectures'
    typo fixes: aera -> area, exntension -> extension
    devices.txt: Fix typo of 'VMware'.
    sis900: Fix enum typo 'sis900_rx_bufer_status'
    decompress_bunzip2: remove invalid vi modeline
    treewide: Fix comment and string typo 'bufer'
    hyper-v: Update MAINTAINERS
    treewide: Fix typos in various parts of the kernel, and fix some comments.
    clockevents: drop unknown Kconfig symbol GENERIC_CLOCKEVENTS_MIGR
    gpio: Kconfig: drop unknown symbol 'CS5535_GPIO'
    leds: Kconfig: Fix typo 'D2NET_V2'
    sound: Kconfig: drop unknown symbol ARCH_CLPS7500
    ...

    Fix up trivial conflicts in arch/powerpc/platforms/40x/Kconfig (some new
    kconfig additions, close to removed commented-out old ones)

    Linus Torvalds
     

04 Jan, 2012

1 commit


12 Dec, 2011

1 commit


29 Sep, 2011

1 commit

  • Take a first step towards untangling Linux kernel header files by
    placing the struct rcu_head definition into include/linux/types.h
    and including include/linux/types.h in include/linux/rcupdate.h
    where struct rcu_head used to be defined. The actual inclusion point
    for include/linux/types.h is with the rest of the #include directives
    rather than at the point where struct rcu_head used to be defined,
    as suggested by Mathieu Desnoyers.

    Once this is in place, then header files that need only rcu_head
    can include types.h rather than rcupdate.h.

    Signed-off-by: Paul E. McKenney
    Cc: Paul Gortmaker
    Acked-by: Mathieu Desnoyers

    Paul E. McKenney
     

23 Mar, 2011

1 commit

  • All architectures can use the common dma_addr_t typedef now. We can
    remove the arch specific dma_addr_t.

    Signed-off-by: FUJITA Tomonori
    Acked-by: Arnd Bergmann
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Ivan Kokshaysky
    Cc: Richard Henderson
    Cc: Matt Turner
    Cc: "Luck, Tony"
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Cc: Chris Metcalf
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    FUJITA Tomonori
     

27 Oct, 2010

1 commit


16 Oct, 2010

1 commit

  • We currently have a kernel internal type called aligned_u64 which aligns
    __u64's on 8 bytes boundaries even on systems which would normally align
    them on 4 byte boundaries. This patch creates a new type __aligned_u64
    which does the same thing but which is exposed to userspace rather than
    being kernel internal.

    [akpm: merge early as both the net and audit trees want this]

    [akpm@linux-foundation.org: enhance the comment describing the reasons for using aligned_u64. Via Andreas and Andi.]
    Based-on-patch-by: Andreas Gruenbacher
    Signed-off-by: Eric Paris
    Cc: Jan Engelhardt
    Cc: David Miller
    Cc: Andi Kleen
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Paris
     

06 Aug, 2010

1 commit


12 Jul, 2010

1 commit

  • Move the preprocessor #warning message:
    warning: #warning Attempt to use kernel headers from user space,
    see http://kernelnewbies.org/KernelHeaders
    from kernel.h to types.h.

    And also fixe the #warning message due to the preprocessor not being able to
    read the web address due to it thinking it was the start of a comment. also
    remove the extra #ifndef _KERNEL_ since it's already there.

    Signed-off-by: Justin P. Mattock
    Cc: Arnd Bergmann
    Signed-off-by: Jiri Kosina

    Justin P. Mattock
     

07 Jul, 2010

1 commit

  • This allows a list_head (or hlist_head, etc.) to be used from places
    that used to be impractical, in particular , which
    used to cause include file recursion: includes
    , which always includes for the
    prefetch macros, as well as , which often includes
    directly or indirectly.

    This avoids a lot of painful workaround hackery on the tile
    architecture, where we use a list_head in the thread_struct to chain
    together tasks that are activated on a particular hardwall.

    Signed-off-by: Chris Metcalf
    Reviewed-by: Matthew Wilcox

    Chris Metcalf
     

17 May, 2010

1 commit

  • When looking at a performance problem on PowerPC, I noticed some awful code
    generation:

    c00000000051fc98: 3b 60 00 01 li r27,1
    ...
    c00000000051fca0: 3b 80 00 00 li r28,0
    ...
    c00000000051fcdc: 93 61 00 70 stw r27,112(r1)
    c00000000051fce0: 93 81 00 74 stw r28,116(r1)
    c00000000051fce4: 81 21 00 70 lwz r9,112(r1)
    c00000000051fce8: 80 01 00 74 lwz r0,116(r1)
    c00000000051fcec: 7d 29 07 b4 extsw r9,r9
    c00000000051fcf0: 7c 00 07 b4 extsw r0,r0

    c00000000051fcf4: 7c 20 04 ac lwsync
    c00000000051fcf8: 7d 60 f8 28 lwarx r11,0,r31
    c00000000051fcfc: 7c 0b 48 00 cmpw r11,r9
    c00000000051fd00: 40 c2 00 10 bne- c00000000051fd10
    c00000000051fd04: 7c 00 f9 2d stwcx. r0,0,r31
    c00000000051fd08: 40 c2 ff f0 bne+ c00000000051fcf8
    c00000000051fd0c: 4c 00 01 2c isync

    We create two constants, write them out to the stack, read them straight back
    in and sign extend them. What a mess.

    It turns out this bad code is a result of us defining atomic_t as a
    volatile int.

    We removed the volatile attribute from the powerpc atomic_t definition years
    ago, but commit ea435467500612636f8f4fb639ff6e76b2496e4b (atomic_t: unify all
    arch definitions) added it back in.

    To dig up an old quote from Linus:

    > The fact is, volatile on data structures is a bug. It's a wart in the C
    > language. It shouldn't be used.
    >
    > Volatile accesses in *code* can be ok, and if we have "atomic_read()"
    > expand to a "*(volatile int *)&(x)->value", then I'd be ok with that.
    >
    > But marking data structures volatile just makes the compiler screw up
    > totally, and makes code for initialization sequences etc much worse.

    And screw up it does :)

    With the volatile removed, we see much more reasonable code generation:

    c00000000051f5b8: 3b 60 00 01 li r27,1
    ...
    c00000000051f5c0: 3b 80 00 00 li r28,0
    ...

    c00000000051fc7c: 7c 20 04 ac lwsync
    c00000000051fc80: 7c 00 f8 28 lwarx r0,0,r31
    c00000000051fc84: 7c 00 d8 00 cmpw r0,r27
    c00000000051fc88: 40 c2 00 10 bne- c00000000051fc98
    c00000000051fc8c: 7f 80 f9 2d stwcx. r28,0,r31
    c00000000051fc90: 40 c2 ff f0 bne+ c00000000051fc80
    c00000000051fc94: 4c 00 01 2c isync

    Six instructions less.

    Signed-off-by: Anton Blanchard
    Signed-off-by: Linus Torvalds

    Anton Blanchard
     

19 Jun, 2009

1 commit

  • Follow-up to "block: enable by default support for large devices
    and files on 32-bit archs".

    Rename CONFIG_LBD to CONFIG_LBDAF to:
    - allow update of existing [def]configs for "default y" change
    - reflect that it is used also for large files support nowadays

    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jens Axboe

    Bartlomiej Zolnierkiewicz
     

27 Mar, 2009

2 commits


06 Feb, 2009

1 commit


08 Jan, 2009

1 commit


07 Jan, 2009

1 commit

  • The atomic_t type cannot currently be used in some header files because it
    would create an include loop with asm/atomic.h. Move the type definition
    to linux/types.h to break the loop.

    Signed-off-by: Matthew Wilcox
    Cc: Huang Ying
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     

29 Dec, 2008

1 commit

  • We have two seperate config entries for large devices/files. One
    is CONFIG_LBD that guards just the devices, the other is CONFIG_LSF
    that handles large files. This doesn't make a lot of sense, you typically
    want both or none. So get rid of CONFIG_LSF and change CONFIG_LBD wording
    to indicate that it covers both.

    Acked-by: Jean Delvare
    Signed-off-by: Jens Axboe

    Jens Axboe
     

21 Oct, 2008

1 commit


14 Sep, 2008

2 commits


25 May, 2008

1 commit

  • can't be used together with because they
    both define struct ustat:

    $ cat test.c
    #include
    #include
    $ gcc -c test.c
    In file included from test.c:2:
    /usr/include/linux/types.h:165: error: redefinition of 'struct ustat'

    has been reported a while ago to debian, but seems to have been
    lost in cat fighting: http://bugs.debian.org/429064

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

    maximilian attems
     

09 Feb, 2008

1 commit


01 Feb, 2008

1 commit


29 Oct, 2007

1 commit

  • Use of ptrdiff_t in places like

    - if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len))
    + if (!access_ok(VERIFY_WRITE, (u8 __user *)
    + (ptrdiff_t) u_tmp->rx_buf,
    + u_tmp->len))

    is wrong; for one thing, it's a bad C (it's what uintptr_t is for; in general
    we are not even promised that ptrdiff_t is large enough to hold a pointer,
    just enough to hold a difference between two pointers within the same object).
    For another, it confuses the fsck out of sparse.

    Use unsigned long or uintptr_t instead. There are several places misusing
    ptrdiff_t; fixed.

    Signed-off-by: Al Viro
    Signed-off-by: Linus Torvalds

    Al Viro
     

20 Oct, 2007

1 commit

  • define first set of BIT* macros

    - move BITOP_MASK and BITOP_WORD from asm-generic/bitops/atomic.h to
    include/linux/bitops.h and rename it to BIT_MASK and BIT_WORD
    - move BITS_TO_LONGS and BITS_PER_BYTE to bitops.h too and allow easily
    define another BITS_TO_something (e.g. in event.c) by BITS_TO_TYPE macro
    Remaining (and common) BIT macro will be defined after all occurences and
    conflicts will be sorted out in the patches.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jiri Slaby