mempolicy.c (d033a308d81ec83908760a15a841c2bd0d5e0ea3) | mempolicy.c (18a2f371f5edf41810f6469cb9be39931ef9deb9) |
---|---|
1/* 2 * Simple NUMA memory policy for the Linux kernel. 3 * 4 * Copyright 2003,2004 Andi Kleen, SuSE Labs. 5 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc. 6 * Subject to the GNU Public License, version 2. 7 * 8 * NUMA policy allows the user to give hints in which node(s) memory should --- 2023 unchanged lines hidden (view full) --- 2032 else 2033 mpol_rebind_policy(new, &mems, MPOL_REBIND_ONCE); 2034 } 2035 rcu_read_unlock(); 2036 atomic_set(&new->refcnt, 1); 2037 return new; 2038} 2039 | 1/* 2 * Simple NUMA memory policy for the Linux kernel. 3 * 4 * Copyright 2003,2004 Andi Kleen, SuSE Labs. 5 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc. 6 * Subject to the GNU Public License, version 2. 7 * 8 * NUMA policy allows the user to give hints in which node(s) memory should --- 2023 unchanged lines hidden (view full) --- 2032 else 2033 mpol_rebind_policy(new, &mems, MPOL_REBIND_ONCE); 2034 } 2035 rcu_read_unlock(); 2036 atomic_set(&new->refcnt, 1); 2037 return new; 2038} 2039 |
2040/* 2041 * If *frompol needs [has] an extra ref, copy *frompol to *tompol , 2042 * eliminate the * MPOL_F_* flags that require conditional ref and 2043 * [NOTE!!!] drop the extra ref. Not safe to reference *frompol directly 2044 * after return. Use the returned value. 2045 * 2046 * Allows use of a mempolicy for, e.g., multiple allocations with a single 2047 * policy lookup, even if the policy needs/has extra ref on lookup. 2048 * shmem_readahead needs this. 2049 */ 2050struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol, 2051 struct mempolicy *frompol) 2052{ 2053 if (!mpol_needs_cond_ref(frompol)) 2054 return frompol; 2055 2056 *tompol = *frompol; 2057 tompol->flags &= ~MPOL_F_SHARED; /* copy doesn't need unref */ 2058 __mpol_put(frompol); 2059 return tompol; 2060} 2061 | |
2062/* Slow path of a mempolicy comparison */ 2063bool __mpol_equal(struct mempolicy *a, struct mempolicy *b) 2064{ 2065 if (!a || !b) 2066 return false; 2067 if (a->mode != b->mode) 2068 return false; 2069 if (a->flags != b->flags) --- 568 unchanged lines hidden --- | 2040/* Slow path of a mempolicy comparison */ 2041bool __mpol_equal(struct mempolicy *a, struct mempolicy *b) 2042{ 2043 if (!a || !b) 2044 return false; 2045 if (a->mode != b->mode) 2046 return false; 2047 if (a->flags != b->flags) --- 568 unchanged lines hidden --- |