Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm'(patches from Andrew)

Merge fixes from Andrew Morton:
"10 fixes"

The lockdep hlist conversion is in the locking tree too, waiting for the
next merge window. Andrew thought it should go in now. I'll take it,
since it fixes a real problem and looks trivially correct (famous last
words).

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
arch/x86/Kconfig: CONFIG_X86_UV should depend on CONFIG_EFI
mm: fix pfn_t vs highmem
kernel/locking/lockdep.c: convert hash tables to hlists
mm,thp: fix spellos in describing __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
mm,thp: khugepaged: call pte flush at the time of collapse
mm/backing-dev.c: fix error path in wb_init()
mm, dax: check for pmd_none() after split_huge_pmd()
vsprintf: kptr_restrict is okay in IRQ when 2
mm: fix filemap.c kernel doc warning
ubsan: cosmetic fix to Kconfig text

+61 -56
+1
arch/x86/Kconfig
··· 475 475 depends on X86_64 476 476 depends on X86_EXTENDED_PLATFORM 477 477 depends on NUMA 478 + depends on EFI 478 479 depends on X86_X2APIC 479 480 depends on PCI 480 481 ---help---
+2 -2
include/linux/lockdep.h
··· 66 66 /* 67 67 * class-hash: 68 68 */ 69 - struct list_head hash_entry; 69 + struct hlist_node hash_entry; 70 70 71 71 /* 72 72 * global list of all lock-classes: ··· 199 199 u8 irq_context; 200 200 u8 depth; 201 201 u16 base; 202 - struct list_head entry; 202 + struct hlist_node entry; 203 203 u64 chain_key; 204 204 }; 205 205
+1 -1
include/linux/pfn.h
··· 10 10 * backing is indicated by flags in the high bits of the value. 11 11 */ 12 12 typedef struct { 13 - unsigned long val; 13 + u64 val; 14 14 } pfn_t; 15 15 #endif 16 16
+8 -9
include/linux/pfn_t.h
··· 9 9 * PFN_DEV - pfn is not covered by system memmap by default 10 10 * PFN_MAP - pfn has a dynamic page mapping established by a device driver 11 11 */ 12 - #define PFN_FLAGS_MASK (((unsigned long) ~PAGE_MASK) \ 13 - << (BITS_PER_LONG - PAGE_SHIFT)) 14 - #define PFN_SG_CHAIN (1UL << (BITS_PER_LONG - 1)) 15 - #define PFN_SG_LAST (1UL << (BITS_PER_LONG - 2)) 16 - #define PFN_DEV (1UL << (BITS_PER_LONG - 3)) 17 - #define PFN_MAP (1UL << (BITS_PER_LONG - 4)) 12 + #define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - PAGE_SHIFT)) 13 + #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1)) 14 + #define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2)) 15 + #define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3)) 16 + #define PFN_MAP (1ULL << (BITS_PER_LONG_LONG - 4)) 18 17 19 - static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, unsigned long flags) 18 + static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, u64 flags) 20 19 { 21 20 pfn_t pfn_t = { .val = pfn | (flags & PFN_FLAGS_MASK), }; 22 21 ··· 28 29 return __pfn_to_pfn_t(pfn, 0); 29 30 } 30 31 31 - extern pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags); 32 + extern pfn_t phys_to_pfn_t(phys_addr_t addr, u64 flags); 32 33 33 34 static inline bool pfn_t_has_page(pfn_t pfn) 34 35 { ··· 86 87 #ifdef __HAVE_ARCH_PTE_DEVMAP 87 88 static inline bool pfn_t_devmap(pfn_t pfn) 88 89 { 89 - const unsigned long flags = PFN_DEV|PFN_MAP; 90 + const u64 flags = PFN_DEV|PFN_MAP; 90 91 91 92 return (pfn.val & flags) == flags; 92 93 }
+19 -23
kernel/locking/lockdep.c
··· 292 292 #define __classhashfn(key) hash_long((unsigned long)key, CLASSHASH_BITS) 293 293 #define classhashentry(key) (classhash_table + __classhashfn((key))) 294 294 295 - static struct list_head classhash_table[CLASSHASH_SIZE]; 295 + static struct hlist_head classhash_table[CLASSHASH_SIZE]; 296 296 297 297 /* 298 298 * We put the lock dependency chains into a hash-table as well, to cache ··· 303 303 #define __chainhashfn(chain) hash_long(chain, CHAINHASH_BITS) 304 304 #define chainhashentry(chain) (chainhash_table + __chainhashfn((chain))) 305 305 306 - static struct list_head chainhash_table[CHAINHASH_SIZE]; 306 + static struct hlist_head chainhash_table[CHAINHASH_SIZE]; 307 307 308 308 /* 309 309 * The hash key of the lock dependency chains is a hash itself too: ··· 666 666 look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) 667 667 { 668 668 struct lockdep_subclass_key *key; 669 - struct list_head *hash_head; 669 + struct hlist_head *hash_head; 670 670 struct lock_class *class; 671 671 672 672 #ifdef CONFIG_DEBUG_LOCKDEP ··· 719 719 if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) 720 720 return NULL; 721 721 722 - list_for_each_entry_rcu(class, hash_head, hash_entry) { 722 + hlist_for_each_entry_rcu(class, hash_head, hash_entry) { 723 723 if (class->key == key) { 724 724 /* 725 725 * Huh! same key, different name? Did someone trample ··· 742 742 register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) 743 743 { 744 744 struct lockdep_subclass_key *key; 745 - struct list_head *hash_head; 745 + struct hlist_head *hash_head; 746 746 struct lock_class *class; 747 747 748 748 DEBUG_LOCKS_WARN_ON(!irqs_disabled()); ··· 774 774 * We have to do the hash-walk again, to avoid races 775 775 * with another CPU: 776 776 */ 777 - list_for_each_entry_rcu(class, hash_head, hash_entry) { 777 + hlist_for_each_entry_rcu(class, hash_head, hash_entry) { 778 778 if (class->key == key) 779 779 goto out_unlock_set; 780 780 } ··· 805 805 * We use RCU's safe list-add method to make 806 806 * parallel walking of the hash-list safe: 807 807 */ 808 - list_add_tail_rcu(&class->hash_entry, hash_head); 808 + hlist_add_head_rcu(&class->hash_entry, hash_head); 809 809 /* 810 810 * Add it to the global list of classes: 811 811 */ ··· 2017 2017 u64 chain_key) 2018 2018 { 2019 2019 struct lock_class *class = hlock_class(hlock); 2020 - struct list_head *hash_head = chainhashentry(chain_key); 2020 + struct hlist_head *hash_head = chainhashentry(chain_key); 2021 2021 struct lock_chain *chain; 2022 2022 struct held_lock *hlock_curr; 2023 2023 int i, j; ··· 2033 2033 * We can walk it lock-free, because entries only get added 2034 2034 * to the hash: 2035 2035 */ 2036 - list_for_each_entry_rcu(chain, hash_head, entry) { 2036 + hlist_for_each_entry_rcu(chain, hash_head, entry) { 2037 2037 if (chain->chain_key == chain_key) { 2038 2038 cache_hit: 2039 2039 debug_atomic_inc(chain_lookup_hits); ··· 2057 2057 /* 2058 2058 * We have to walk the chain again locked - to avoid duplicates: 2059 2059 */ 2060 - list_for_each_entry(chain, hash_head, entry) { 2060 + hlist_for_each_entry(chain, hash_head, entry) { 2061 2061 if (chain->chain_key == chain_key) { 2062 2062 graph_unlock(); 2063 2063 goto cache_hit; ··· 2091 2091 } 2092 2092 chain_hlocks[chain->base + j] = class - lock_classes; 2093 2093 } 2094 - list_add_tail_rcu(&chain->entry, hash_head); 2094 + hlist_add_head_rcu(&chain->entry, hash_head); 2095 2095 debug_atomic_inc(chain_lookup_misses); 2096 2096 inc_chains(); 2097 2097 ··· 3875 3875 nr_process_chains = 0; 3876 3876 debug_locks = 1; 3877 3877 for (i = 0; i < CHAINHASH_SIZE; i++) 3878 - INIT_LIST_HEAD(chainhash_table + i); 3878 + INIT_HLIST_HEAD(chainhash_table + i); 3879 3879 raw_local_irq_restore(flags); 3880 3880 } 3881 3881 ··· 3894 3894 /* 3895 3895 * Unhash the class and remove it from the all_lock_classes list: 3896 3896 */ 3897 - list_del_rcu(&class->hash_entry); 3897 + hlist_del_rcu(&class->hash_entry); 3898 3898 list_del_rcu(&class->lock_entry); 3899 3899 3900 3900 RCU_INIT_POINTER(class->key, NULL); ··· 3917 3917 void lockdep_free_key_range(void *start, unsigned long size) 3918 3918 { 3919 3919 struct lock_class *class; 3920 - struct list_head *head; 3920 + struct hlist_head *head; 3921 3921 unsigned long flags; 3922 3922 int i; 3923 3923 int locked; ··· 3930 3930 */ 3931 3931 for (i = 0; i < CLASSHASH_SIZE; i++) { 3932 3932 head = classhash_table + i; 3933 - if (list_empty(head)) 3934 - continue; 3935 - list_for_each_entry_rcu(class, head, hash_entry) { 3933 + hlist_for_each_entry_rcu(class, head, hash_entry) { 3936 3934 if (within(class->key, start, size)) 3937 3935 zap_class(class); 3938 3936 else if (within(class->name, start, size)) ··· 3960 3962 void lockdep_reset_lock(struct lockdep_map *lock) 3961 3963 { 3962 3964 struct lock_class *class; 3963 - struct list_head *head; 3965 + struct hlist_head *head; 3964 3966 unsigned long flags; 3965 3967 int i, j; 3966 3968 int locked; ··· 3985 3987 locked = graph_lock(); 3986 3988 for (i = 0; i < CLASSHASH_SIZE; i++) { 3987 3989 head = classhash_table + i; 3988 - if (list_empty(head)) 3989 - continue; 3990 - list_for_each_entry_rcu(class, head, hash_entry) { 3990 + hlist_for_each_entry_rcu(class, head, hash_entry) { 3991 3991 int match = 0; 3992 3992 3993 3993 for (j = 0; j < NR_LOCKDEP_CACHING_CLASSES; j++) ··· 4023 4027 return; 4024 4028 4025 4029 for (i = 0; i < CLASSHASH_SIZE; i++) 4026 - INIT_LIST_HEAD(classhash_table + i); 4030 + INIT_HLIST_HEAD(classhash_table + i); 4027 4031 4028 4032 for (i = 0; i < CHAINHASH_SIZE; i++) 4029 - INIT_LIST_HEAD(chainhash_table + i); 4033 + INIT_HLIST_HEAD(chainhash_table + i); 4030 4034 4031 4035 lockdep_initialized = 1; 4032 4036 }
+1 -1
kernel/memremap.c
··· 150 150 } 151 151 EXPORT_SYMBOL(devm_memunmap); 152 152 153 - pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags) 153 + pfn_t phys_to_pfn_t(phys_addr_t addr, u64 flags) 154 154 { 155 155 return __pfn_to_pfn_t(addr >> PAGE_SHIFT, flags); 156 156 }
+3 -1
lib/Kconfig.ubsan
··· 18 18 This option activates instrumentation for the entire kernel. 19 19 If you don't enable this option, you have to explicitly specify 20 20 UBSAN_SANITIZE := y for the files/directories you want to check for UB. 21 + Enabling this option will get kernel image size increased 22 + significantly. 21 23 22 24 config UBSAN_ALIGNMENT 23 25 bool "Enable checking of pointers alignment" ··· 27 25 default y if !HAVE_EFFICIENT_UNALIGNED_ACCESS 28 26 help 29 27 This option enables detection of unaligned memory accesses. 30 - Enabling this option on architectures that support unalligned 28 + Enabling this option on architectures that support unaligned 31 29 accesses may produce a lot of false positives.
+13 -13
lib/vsprintf.c
··· 1590 1590 return buf; 1591 1591 } 1592 1592 case 'K': 1593 - /* 1594 - * %pK cannot be used in IRQ context because its test 1595 - * for CAP_SYSLOG would be meaningless. 1596 - */ 1597 - if (kptr_restrict && (in_irq() || in_serving_softirq() || 1598 - in_nmi())) { 1599 - if (spec.field_width == -1) 1600 - spec.field_width = default_width; 1601 - return string(buf, end, "pK-error", spec); 1602 - } 1603 - 1604 1593 switch (kptr_restrict) { 1605 1594 case 0: 1606 1595 /* Always print %pK values */ 1607 1596 break; 1608 1597 case 1: { 1598 + const struct cred *cred; 1599 + 1600 + /* 1601 + * kptr_restrict==1 cannot be used in IRQ context 1602 + * because its test for CAP_SYSLOG would be meaningless. 1603 + */ 1604 + if (in_irq() || in_serving_softirq() || in_nmi()) { 1605 + if (spec.field_width == -1) 1606 + spec.field_width = default_width; 1607 + return string(buf, end, "pK-error", spec); 1608 + } 1609 + 1609 1610 /* 1610 1611 * Only print the real pointer value if the current 1611 1612 * process has CAP_SYSLOG and is running with the ··· 1616 1615 * leak pointer values if a binary opens a file using 1617 1616 * %pK and then elevates privileges before reading it. 1618 1617 */ 1619 - const struct cred *cred = current_cred(); 1620 - 1618 + cred = current_cred(); 1621 1619 if (!has_capability_noaudit(current, CAP_SYSLOG) || 1622 1620 !uid_eq(cred->euid, cred->uid) || 1623 1621 !gid_eq(cred->egid, cred->gid))
+1 -1
mm/backing-dev.c
··· 328 328 return 0; 329 329 330 330 out_destroy_stat: 331 - while (--i) 331 + while (i--) 332 332 percpu_counter_destroy(&wb->stat[i]); 333 333 fprop_local_destroy_percpu(&wb->completions); 334 334 out_put_cong:
+1
mm/filemap.c
··· 1890 1890 * page_cache_read - adds requested page to the page cache if not already there 1891 1891 * @file: file to read 1892 1892 * @offset: page index 1893 + * @gfp_mask: memory allocation flags 1893 1894 * 1894 1895 * This adds the requested page to the page cache if it isn't already there, 1895 1896 * and schedules an I/O to read in its contents from disk.
+4 -2
mm/mprotect.c
··· 160 160 } 161 161 162 162 if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) { 163 - if (next - addr != HPAGE_PMD_SIZE) 163 + if (next - addr != HPAGE_PMD_SIZE) { 164 164 split_huge_pmd(vma, pmd, addr); 165 - else { 165 + if (pmd_none(*pmd)) 166 + continue; 167 + } else { 166 168 int nr_ptes = change_huge_pmd(vma, pmd, addr, 167 169 newprot, prot_numa); 168 170
+2
mm/mremap.c
··· 210 210 } 211 211 } 212 212 split_huge_pmd(vma, old_pmd, old_addr); 213 + if (pmd_none(*old_pmd)) 214 + continue; 213 215 VM_BUG_ON(pmd_trans_huge(*old_pmd)); 214 216 } 215 217 if (pmd_none(*new_pmd) && __pte_alloc(new_vma->vm_mm, new_vma,
+5 -3
mm/pgtable-generic.c
··· 90 90 * ARCHes with special requirements for evicting THP backing TLB entries can 91 91 * implement this. Otherwise also, it can help optimize normal TLB flush in 92 92 * THP regime. stock flush_tlb_range() typically has optimization to nuke the 93 - * entire TLB TLB if flush span is greater than a threshhold, which will 93 + * entire TLB if flush span is greater than a threshold, which will 94 94 * likely be true for a single huge page. Thus a single thp flush will 95 - * invalidate the entire TLB which is not desitable. 95 + * invalidate the entire TLB which is not desirable. 96 96 * e.g. see arch/arc: flush_pmd_tlb_range 97 97 */ 98 98 #define flush_pmd_tlb_range(vma, addr, end) flush_tlb_range(vma, addr, end) ··· 195 195 VM_BUG_ON(address & ~HPAGE_PMD_MASK); 196 196 VM_BUG_ON(pmd_trans_huge(*pmdp)); 197 197 pmd = pmdp_huge_get_and_clear(vma->vm_mm, address, pmdp); 198 - flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE); 198 + 199 + /* collapse entails shooting down ptes not pmd */ 200 + flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE); 199 201 return pmd; 200 202 } 201 203 #endif