13 Jun, 2014

1 commit

  • Pull networking updates from David Miller:

    1) Seccomp BPF filters can now be JIT'd, from Alexei Starovoitov.

    2) Multiqueue support in xen-netback and xen-netfront, from Andrew J
    Benniston.

    3) Allow tweaking of aggregation settings in cdc_ncm driver, from Bjørn
    Mork.

    4) BPF now has a "random" opcode, from Chema Gonzalez.

    5) Add more BPF documentation and improve test framework, from Daniel
    Borkmann.

    6) Support TCP fastopen over ipv6, from Daniel Lee.

    7) Add software TSO helper functions and use them to support software
    TSO in mvneta and mv643xx_eth drivers. From Ezequiel Garcia.

    8) Support software TSO in fec driver too, from Nimrod Andy.

    9) Add Broadcom SYSTEMPORT driver, from Florian Fainelli.

    10) Handle broadcasts more gracefully over macvlan when there are large
    numbers of interfaces configured, from Herbert Xu.

    11) Allow more control over fwmark used for non-socket based responses,
    from Lorenzo Colitti.

    12) Do TCP congestion window limiting based upon measurements, from Neal
    Cardwell.

    13) Support busy polling in SCTP, from Neal Horman.

    14) Allow RSS key to be configured via ethtool, from Venkata Duvvuru.

    15) Bridge promisc mode handling improvements from Vlad Yasevich.

    16) Don't use inetpeer entries to implement ID generation any more, it
    performs poorly, from Eric Dumazet.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1522 commits)
    rtnetlink: fix userspace API breakage for iproute2 < v3.9.0
    tcp: fixing TLP's FIN recovery
    net: fec: Add software TSO support
    net: fec: Add Scatter/gather support
    net: fec: Increase buffer descriptor entry number
    net: fec: Factorize feature setting
    net: fec: Enable IP header hardware checksum
    net: fec: Factorize the .xmit transmit function
    bridge: fix compile error when compiling without IPv6 support
    bridge: fix smatch warning / potential null pointer dereference
    via-rhine: fix full-duplex with autoneg disable
    bnx2x: Enlarge the dorq threshold for VFs
    bnx2x: Check for UNDI in uncommon branch
    bnx2x: Fix 1G-baseT link
    bnx2x: Fix link for KR with swapped polarity lane
    sctp: Fix sk_ack_backlog wrap-around problem
    net/core: Add VF link state control policy
    net/fsl: xgmac_mdio is dependent on OF_MDIO
    net/fsl: Make xgmac_mdio read error message useful
    net_sched: drr: warn when qdisc is not work conserving
    ...

    Linus Torvalds
     

12 Jun, 2014

1 commit

  • This function sets the n'th cpu - local cpu's first.
    For example: in a 16 cores server with even cpu's local, will get the
    following values:
    cpumask_set_cpu_local_first(0, numa, cpumask) => cpu 0 is set
    cpumask_set_cpu_local_first(1, numa, cpumask) => cpu 2 is set
    ...
    cpumask_set_cpu_local_first(7, numa, cpumask) => cpu 14 is set
    cpumask_set_cpu_local_first(8, numa, cpumask) => cpu 1 is set
    cpumask_set_cpu_local_first(9, numa, cpumask) => cpu 3 is set
    ...
    cpumask_set_cpu_local_first(15, numa, cpumask) => cpu 15 is set

    Curently this function will be used by multi queue networking devices to
    calculate the irq affinity mask, such that as many local cpu's as
    possible will be utilized to handle the mq device irq's.

    Signed-off-by: Amir Vadai
    Signed-off-by: David S. Miller

    Amir Vadai
     

02 Jun, 2014

2 commits

  • This reverts commit 70a640d0dae3a9b1b222ce673eb5d92c263ddd61
    ("net/mlx4_en: Use affinity hint") and commit
    c8865b64b05b2f4eeefd369373e9c8aeb069e7a1 ("cpumask: Utility function
    to set n'th cpu - local cpu first") because these changes break
    the build when SMP is disabled amongst other things.

    Reported-by: Eric Dumazet
    Signed-off-by: David S. Miller

    David S. Miller
     
  • This function sets the n'th cpu - local cpu's first.
    For example: in a 16 cores server with even cpu's local, will get the
    following values:
    cpumask_set_cpu_local_first(0, numa, cpumask) => cpu 0 is set
    cpumask_set_cpu_local_first(1, numa, cpumask) => cpu 2 is set
    ...
    cpumask_set_cpu_local_first(7, numa, cpumask) => cpu 14 is set
    cpumask_set_cpu_local_first(8, numa, cpumask) => cpu 1 is set
    cpumask_set_cpu_local_first(9, numa, cpumask) => cpu 3 is set
    ...
    cpumask_set_cpu_local_first(15, numa, cpumask) => cpu 15 is set

    Curently this function will be used by multi queue networking devices to
    calculate the irq affinity mask, such that as many local cpu's as
    possible will be utilized to handle the mq device irq's.

    Signed-off-by: Amir Vadai
    Signed-off-by: David S. Miller

    Amir Vadai
     

14 May, 2014

1 commit

  • Silence the warning when building with -Wsign-compare when cpumask.h
    is included:

    include/linux/cpumask.h: In function ‘cpumask_parse’:
    include/linux/cpumask.h:603:26: warning: signed and unsigned type in conditional expression [-Wsign-compare]
    int len = nl ? nl - buf : strlen(buf);
    ^

    V2: Rusty pointed out that unsigned should be used instead.

    Signed-off-by: Brian W Hart
    Signed-off-by: Rusty Russell

    Brian W Hart
     

13 Mar, 2013

1 commit

  • We have cpulist_parse() but not cpumask_parse(). Implement it using
    bitmap_parse().

    bitmap_parse() is weird in that it takes @len for a string in
    kernel-memory which also is inconsistent with bitmap_parselist().
    Make cpumask_parse() calculate the length and don't expose the
    inconsistency to cpumask users. Maybe we can fix up bitmap_parse()
    later.

    This will be used to expose workqueue cpumask knobs to userland via
    sysfs.

    Signed-off-by: Tejun Heo
    Cc: Rusty Russell

    Tejun Heo
     

27 Jul, 2012

2 commits

  • As introduced in Rusty's commit 29c0177e6a4, the function has no
    parameter @len, so need to remove it from comments to avoid kernel-doc
    warning:

    alexs@debian:~/linux-next$ scripts/kernel-doc -man
    include/linux/cpumask.h | split-man.pl /tmp/man
    ....
    Warning(include/linux/cpumask.h:602): Excess function parameter 'len'
    description in 'cpulist_parse'

    and correct the function name in comments to cpulist_parse.

    Signed-off-by: Alex Shi
    Signed-off-by: Rusty Russell

    Alex Shi
     
  • Current few cpumask functions' purposes are not quite clear. Stupid
    user like myself needs to dig into details for clear function
    purpose and return value.
    Add few explanation for them is helpful.

    Thanks for Srivatsa's comments and correction!

    Signed-off-by: Alex Shi
    Acked-by: KOSAKI Motohiro
    Signed-off-by: Rusty Russell

    Alex Shi
     

29 Mar, 2012

2 commits


05 Mar, 2012

1 commit

  • If a header file is making use of BUG, BUG_ON, BUILD_BUG_ON, or any
    other BUG variant in a static inline (i.e. not in a #define) then
    that header really should be including and not just
    expecting it to be implicitly present.

    We can make this change risk-free, since if the files using these
    headers didn't have exposure to linux/bug.h already, they would have
    been causing compile failures/warnings.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

27 Jul, 2011

1 commit


25 May, 2011

1 commit

  • Manually adjusting the smp_affinity for IRQ's becomes unwieldy when the
    cpu count is large.

    Setting smp affinity to cpus 256 to 263 would be:

    echo 000000ff,00000000,00000000,00000000,00000000,00000000,00000000,00000000 > smp_affinity

    instead of:

    echo 256-263 > smp_affinity_list

    Think about what it looks like for cpus around say, 4088 to 4095.

    We already have many alternate "list" interfaces:

    /sys/devices/system/cpu/cpuX/indexY/shared_cpu_list
    /sys/devices/system/cpu/cpuX/topology/thread_siblings_list
    /sys/devices/system/cpu/cpuX/topology/core_siblings_list
    /sys/devices/system/node/nodeX/cpulist
    /sys/devices/pci***/***/local_cpulist

    Add a companion interface, smp_affinity_list to use cpu lists instead of
    cpu maps. This conforms to other companion interfaces where both a map
    and a list interface exists.

    This required adding a bitmap_parselist_user() function in a manner
    similar to the bitmap_parse_user() function.

    [akpm@linux-foundation.org: make __bitmap_parselist() static]
    Signed-off-by: Mike Travis
    Cc: Thomas Gleixner
    Cc: Jack Steiner
    Cc: Lee Schermerhorn
    Cc: Andy Shevchenko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Travis
     

07 Mar, 2010

1 commit

  • Dependent on CONFIG_SMP the num_*_cpus() functions return unsigned or
    signed values. Let them always return unsigned values to avoid strange
    casts.

    Fixes at least one warning:

    kernel/kprobes.c: In function 'register_kretprobe':
    kernel/kprobes.c:1038: warning: comparison of distinct pointer types lacks a cast

    Signed-off-by: Heiko Carstens
    Cc: Heiko Carstens
    Cc: Ananth N Mavinakayanahalli
    Cc: Masami Hiramatsu
    Cc: Ingo Molnar
    Cc: Rusty Russell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Heiko Carstens
     

25 Feb, 2010

1 commit

  • Currently, rcu_needs_cpu() simply checks whether the current CPU
    has an outstanding RCU callback, which means that the last CPU
    to go into dyntick-idle mode might wait a few ticks for the
    relevant grace periods to complete. However, if all the other
    CPUs are in dyntick-idle mode, and if this CPU is in a quiescent
    state (which it is for RCU-bh and RCU-sched any time that we are
    considering going into dyntick-idle mode), then the grace period
    is instantly complete.

    This patch therefore repeatedly invokes the RCU grace-period
    machinery in order to force any needed grace periods to complete
    quickly. It does so a limited number of times in order to
    prevent starvation by an RCU callback function that might pass
    itself to call_rcu().

    However, if any CPU other than the current one is not in
    dyntick-idle mode, fall back to simply checking (with fix to bug
    noted by Lai Jiangshan). Also, take advantage of last
    grace-period forcing, the opportunity to do so noted by Steve
    Rostedt. And apply simplified #ifdef condition suggested by
    Frederic Weisbecker.

    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

07 Dec, 2009

1 commit

  • Since (e761b77: cpu hotplug, sched: Introduce cpu_active_map and redo
    sched domain managment) we have cpu_active_mask which is suppose to rule
    scheduler migration and load-balancing, except it never (fully) did.

    The particular problem being solved here is a crash in try_to_wake_up()
    where select_task_rq() ends up selecting an offline cpu because
    select_task_rq_fair() trusts the sched_domain tree to reflect the
    current state of affairs, similarly select_task_rq_rt() trusts the
    root_domain.

    However, the sched_domains are updated from CPU_DEAD, which is after the
    cpu is taken offline and after stop_machine is done. Therefore it can
    race perfectly well with code assuming the domains are right.

    Cure this by building the domains from cpu_active_mask on
    CPU_DOWN_PREPARE.

    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

24 Sep, 2009

4 commits

  • The new ones have pretty kerneldoc. Move the old ones to the end to
    avoid confusing people.

    Signed-off-by: Rusty Russell
    Cc: benh@kernel.crashing.org

    Rusty Russell
     
  • We're not forcing removal of the old cpu_ functions, but we might as
    well delete the now-unused ones.

    Especially CPUMASK_ALLOC and friends. I actually got a phone call (!)
    from a hacker who thought I had introduced them as the new cpumask
    API. He seemed bewildered that I had lost all taste.

    Signed-off-by: Rusty Russell
    Cc: benh@kernel.crashing.org

    Rusty Russell
     
  • It's only defined for NR_CPUS > BITS_PER_LONG; cpu_all_mask is always
    defined (and const).

    Signed-off-by: Rusty Russell

    Rusty Russell
     
  • (Thanks to Al Viro for reminding me of this, via Ingo)

    CPU_MASK_ALL is the (deprecated) "all bits set" cpumask, defined as so:

    #define CPU_MASK_ALL (cpumask_t) { { ... } }

    Taking the address of such a temporary is questionable at best,
    unfortunately 321a8e9d (cpumask: add CPU_MASK_ALL_PTR macro) added
    CPU_MASK_ALL_PTR:

    #define CPU_MASK_ALL_PTR (&CPU_MASK_ALL)

    Which formalizes this practice. One day gcc could bite us over this
    usage (though we seem to have gotten away with it so far).

    Now all callers are removed, we kill it.

    Signed-off-by: Rusty Russell
    Acked-by: Ingo Molnar
    Reported-by: Al Viro
    Cc: Mike Travis

    Rusty Russell
     

23 Sep, 2009

1 commit

  • 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
     

22 Aug, 2009

1 commit

  • When 'and'ing two bitmasks (where 'andnot' is a variation on it), some
    cases want to know whether the result is the empty set or not. In
    particular, the TLB IPI sending code wants to do cpumask operations and
    determine if there are any CPU's left in the final set.

    So this just makes the bitmask (and cpumask) functions return a boolean
    for whether the result has any bits set.

    Cc: stable@kernel.org (2.6.30, needed by TLB shootdown fix)
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

09 Jun, 2009

1 commit


01 Jan, 2009

1 commit


30 Dec, 2008

3 commits

  • They're only for use in boot/cpu hotplug code anyway, and this avoids
    the use of deprecated cpu_*_map.

    Stephen Rothwell points out that gcc 4.2.4 (on powerpc at least)
    didn't like the cast away of const anyway:

    include/linux/cpumask.h: In function 'set_cpu_possible':
    include/linux/cpumask.h:1052: warning: passing argument 2 of 'cpumask_set_cpu' discards qualifiers from pointer target type

    So this kills two birds with one stone.

    Signed-off-by: Rusty Russell

    Rusty Russell
     
  • Changes:
    1) cpumask_t to struct cpumask,
    2) cpus_weight_nr to cpumask_weight,
    3) cpu_isset to cpumask_test_cpu,
    4) ->bits to cpumask_bits()
    5) cpu_*_map to cpu_*_mask.
    6) for_each_cpu_mask_nr to for_each_cpu

    Signed-off-by: Rusty Russell

    Rusty Russell
     
  • Impact: cleanup

    This implements the obsolescent cpu_online_map in terms of
    cpu_online_mask, rather than the other way around. Same for the other
    maps.

    The documentation comments are also updated to refer to _mask rather
    than _map.

    Signed-off-by: Rusty Russell
    Signed-off-by: Mike Travis

    Rusty Russell
     

19 Dec, 2008

1 commit

  • Impact: New API

    This will be needed in x86 code to allocate the domain and old_domain
    cpumasks on the same node as where the containing irq_cfg struct is
    allocated.

    (Also fixes double-dump_stack on rare CONFIG_DEBUG_PER_CPU_MAPS case)

    Signed-off-by: Mike Travis
    Signed-off-by: Rusty Russell (re-impl alloc_cpumask_var)

    Mike Travis
     

13 Dec, 2008

2 commits

  • Impact: futureproof as we convert more code to new APIs

    The old cpumask operators treat all NR_CPUS bits as relevent, the new
    ones use nr_cpumask_bits. For large NR_CPUS and small nr_cpu_ids, this
    makes a difference.

    However, mixing the two can cause problems with undefined bits. An
    arch which sets CONFIG_CPUMASK_OFFSTACK should have converted across
    to the new operators, so it's safe in that case.

    (Thanks to Stephen Rothwell for bisecting the initial unused-bits bug,
    and Mike Travis for this solution).

    Signed-off-by: Rusty Russell
    Cc: Mike Travis

    Rusty Russell
     
  • …t_scnprintf to take pointers.

    Impact: change calling convention of existing cpumask APIs

    Most cpumask functions started with cpus_: these have been replaced by
    cpumask_ ones which take struct cpumask pointers as expected.

    These four functions don't have good replacement names; fortunately
    they're rarely used, so we just change them over.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: Mike Travis <travis@sgi.com>
    Acked-by: Ingo Molnar <mingo@elte.hu>
    Cc: paulus@samba.org
    Cc: mingo@redhat.com
    Cc: tony.luck@intel.com
    Cc: ralf@linux-mips.org
    Cc: Greg Kroah-Hartman <gregkh@suse.de>
    Cc: cl@linux-foundation.org
    Cc: srostedt@redhat.com

    Rusty Russell
     

10 Nov, 2008

1 commit


07 Nov, 2008

1 commit


06 Nov, 2008

1 commit

  • Impact: introduce new APIs

    We want to deprecate cpumasks on the stack, as we are headed for
    gynormous numbers of CPUs. Eventually, we want to head towards an
    undefined 'struct cpumask' so they can never be declared on stack.

    1) New cpumask functions which take pointers instead of copies.
    (cpus_* -> cpumask_*)

    2) Several new helpers to reduce requirements for temporary cpumasks
    (cpumask_first_and, cpumask_next_and, cpumask_any_and)

    3) Helpers for declaring cpumasks on or offstack for large NR_CPUS
    (cpumask_var_t, alloc_cpumask_var and free_cpumask_var)

    4) 'struct cpumask' for explicitness and to mark new-style code.

    5) Make iterator functions stop at nr_cpu_ids (a runtime constant),
    not NR_CPUS for time efficiency and for smaller dynamic allocations
    in future.

    6) cpumask_copy() so we can allocate less than a full cpumask eventually
    (for alloc_cpumask_var), and so we can eliminate the 'struct cpumask'
    definition eventually.

    7) work_on_cpu() helper for doing task on a CPU, rather than saving old
    cpumask for current thread and manipulating it.

    8) smp_call_function_many() which is smp_call_function_mask() except
    taking a cpumask pointer.

    Note that this patch simply introduces the new functions and leaves
    the obsolescent ones in place. This is to simplify the transition
    patches.

    Signed-off-by: Rusty Russell
    Signed-off-by: Ingo Molnar

    Rusty Russell
     

31 Jul, 2008

1 commit

  • when you take the address of the result. Noticed on a sparc64 compile
    using a version 3.4.5 cross compiler.

    kernel/time/tick-common.c: In function `tick_check_new_device':
    kernel/time/tick-common.c:210: error: invalid lvalue in unary `&'
    ...

    Just make it a regular expression.

    Signed-off-by: Stephen Rothwell
    Acked-by: Ingo Molnar
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     

29 Jul, 2008

1 commit

  • Clean up and optimize cpumask_of_cpu(), by sharing all the zero words.

    Instead of stupidly generating all possible i=0...NR_CPUS 2^i patterns
    creating a huge array of constant bitmasks, realize that the zero words
    can be shared.

    In other words, on a 64-bit architecture, we only ever need 64 of these
    arrays - with a different bit set in one single world (with enough zero
    words around it so that we can create any bitmask by just offsetting in
    that big array). And then we just put enough zeroes around it that we
    can point every single cpumask to be one of those things.

    So when we have 4k CPU's, instead of having 4k arrays (of 4k bits each,
    with one bit set in each array - 2MB memory total), we have exactly 64
    arrays instead, each 8k bits in size (64kB total).

    And then we just point cpumask(n) to the right position (which we can
    calculate dynamically). Once we have the right arrays, getting
    "cpumask(n)" ends up being:

    static inline const cpumask_t *get_cpu_mask(unsigned int cpu)
    {
    const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
    p -= cpu / BITS_PER_LONG;
    return (const cpumask_t *)p;
    }

    This brings other advantages and simplifications as well:

    - we are not wasting memory that is just filled with a single bit in
    various different places

    - we don't need all those games to re-create the arrays in some dense
    format, because they're already going to be dense enough.

    if we compile a kernel for up to 4k CPU's, "wasting" that 64kB of memory
    is a non-issue (especially since by doing this "overlapping" trick we
    probably get better cache behaviour anyway).

    [ mingo@elte.hu:

    Converted Linus's mails into a commit. See:

    http://lkml.org/lkml/2008/7/27/156
    http://lkml.org/lkml/2008/7/28/320

    Also applied a family filter - which also has the side-effect of leaving
    out the bits where Linus calls me an idio... Oh, never mind ;-)
    ]

    Signed-off-by: Ingo Molnar
    Cc: Rusty Russell
    Cc: Andrew Morton
    Cc: Al Viro
    Cc: Mike Travis
    Signed-off-by: Ingo Molnar

    Linus Torvalds
     

26 Jul, 2008

1 commit

  • If an arch doesn't define cpumask_of_cpu_map, create a generic
    statically-initialized one for them. This allows removal of the buggy
    cpumask_of_cpu() macro (&cpumask_of_cpu() gives address of
    out-of-scope var).

    An arch with NR_CPUS of 4096 probably wants to allocate this itself
    based on the actual number of CPUs, since otherwise they're using 2MB
    of rodata (1024 cpus means 128k). That's what
    CONFIG_HAVE_CPUMASK_OF_CPU_MAP is for (only x86/64 does so at the
    moment).

    In future as we support more CPUs, we'll need to resort to a
    get_cpu_map()/put_cpu_map() allocation scheme.

    Signed-off-by: Mike Travis
    Signed-off-by: Rusty Russell
    Cc: Andrew Morton
    Cc: Jack Steiner
    Signed-off-by: Ingo Molnar

    Mike Travis
     

24 Jul, 2008

1 commit

  • * 'sched/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    sched: hrtick_enabled() should use cpu_active()
    sched, x86: clean up hrtick implementation
    sched: fix build error, provide partition_sched_domains() unconditionally
    sched: fix warning in inc_rt_tasks() to not declare variable 'rq' if it's not needed
    cpu hotplug: Make cpu_active_map synchronization dependency clear
    cpu hotplug, sched: Introduce cpu_active_map and redo sched domain managment (take 2)
    sched: rework of "prioritize non-migratable tasks over migratable ones"
    sched: reduce stack size in isolated_cpu_setup()
    Revert parts of "ftrace: do not trace scheduler functions"

    Fixed up conflicts in include/asm-x86/thread_info.h (due to the
    TIF_SINGLESTEP unification vs TIF_HRTICK_RESCHED removal) and
    kernel/sched_fair.c (due to cpu_active_map vs for_each_cpu_mask_nr()
    introduction).

    Linus Torvalds
     

20 Jul, 2008

1 commit


19 Jul, 2008

2 commits

  • * Provide a generic set of CPUMASK_ALLOC macros patterned after the
    SCHED_CPUMASK_ALLOC macros. This is used where multiple cpumask_t
    variables are declared on the stack to reduce the amount of stack
    space required.

    Signed-off-by: Mike Travis
    Signed-off-by: Ingo Molnar

    Mike Travis
     
  • * This patch replaces the dangerous lvalue version of cpumask_of_cpu
    with new cpumask_of_cpu_ptr macros. These are patterned after the
    node_to_cpumask_ptr macros.

    In general terms, if there is a cpumask_of_cpu_map[] then a pointer to
    the cpumask_of_cpu_map[cpu] entry is used. The cpumask_of_cpu_map
    is provided when there is a large NR_CPUS count, reducing
    greatly the amount of code generated and stack space used for
    cpumask_of_cpu(). The pointer to the cpumask_t value is needed for
    calling set_cpus_allowed_ptr() to reduce the amount of stack space
    needed to pass the cpumask_t value.

    If there isn't a cpumask_of_cpu_map[], then a temporary variable is
    declared and filled in with value from cpumask_of_cpu(cpu) as well as
    a pointer variable pointing to this temporary variable. Afterwards,
    the pointer is used to reference the cpumask value. The compiler
    will optimize out the extra dereference through the pointer as well
    as the stack space used for the pointer, resulting in identical code.

    A good example of the orthogonal usages is in net/sunrpc/svc.c:

    case SVC_POOL_PERCPU:
    {
    unsigned int cpu = m->pool_to[pidx];
    cpumask_of_cpu_ptr(cpumask, cpu);

    *oldmask = current->cpus_allowed;
    set_cpus_allowed_ptr(current, cpumask);
    return 1;
    }
    case SVC_POOL_PERNODE:
    {
    unsigned int node = m->pool_to[pidx];
    node_to_cpumask_ptr(nodecpumask, node);

    *oldmask = current->cpus_allowed;
    set_cpus_allowed_ptr(current, nodecpumask);
    return 1;
    }

    Signed-off-by: Mike Travis
    Signed-off-by: Ingo Molnar

    Mike Travis