1. 28 5月, 2022 16 次提交
  2. 26 5月, 2022 17 次提交
  3. 20 5月, 2022 7 次提交
    • K
      mm: damon: use HPAGE_PMD_SIZE · 02e34fff
      Kefeng Wang 提交于
      Use HPAGE_PMD_SIZE instead of open coding.
      
      Link: https://lkml.kernel.org/r/20220517145120.118523-1-wangkefeng.wang@huawei.comSigned-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Reviewed-by: NSeongJae Park <sj@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      02e34fff
    • V
      tracing: incorrect isolate_mote_t cast in mm_vmscan_lru_isolate · 2b132903
      Vasily Averin 提交于
      Fixes following sparse warnings:
      
        CHECK   mm/vmscan.c
      mm/vmscan.c: note: in included file (through
      include/trace/trace_events.h, include/trace/define_trace.h,
      include/trace/events/vmscan.h):
      ./include/trace/events/vmscan.h:281:1: sparse: warning:
       cast to restricted isolate_mode_t
      ./include/trace/events/vmscan.h:281:1: sparse: warning:
       restricted isolate_mode_t degrades to integer
      
      Link: https://lkml.kernel.org/r/e85d7ff2-fd10-53f8-c24e-ba0458439c1b@openvz.orgSigned-off-by: NVasily Averin <vvs@openvz.org>
      Acked-by: NSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      2b132903
    • C
      nodemask.h: fix compilation error with GCC12 · 37462a92
      Christophe de Dinechin 提交于
      With gcc version 12.0.1 20220401 (Red Hat 12.0.1-0), building with
      defconfig results in the following compilation error:
      
      |   CC      mm/swapfile.o
      | mm/swapfile.c: In function `setup_swap_info':
      | mm/swapfile.c:2291:47: error: array subscript -1 is below array bounds
      |  of `struct plist_node[]' [-Werror=array-bounds]
      |  2291 |                                 p->avail_lists[i].prio = 1;
      |       |                                 ~~~~~~~~~~~~~~^~~
      | In file included from mm/swapfile.c:16:
      | ./include/linux/swap.h:292:27: note: while referencing `avail_lists'
      |   292 |         struct plist_node avail_lists[]; /*
      |       |                           ^~~~~~~~~~~
      
      This is due to the compiler detecting that the mask in
      node_states[__state] could theoretically be zero, which would lead to
      first_node() returning -1 through find_first_bit.
      
      I believe that the warning/error is legitimate.  I first tried adding a
      test to check that the node mask is not emtpy, since a similar test exists
      in the case where MAX_NUMNODES == 1.
      
      However, adding the if statement causes other warnings to appear in
      for_each_cpu_node_but, because it introduces a dangling else ambiguity. 
      And unfortunately, GCC is not smart enough to detect that the added test
      makes the case where (node) == -1 impossible, so it still complains with
      the same message.
      
      This is why I settled on replacing that with a harmless, but relatively
      useless (node) >= 0 test.  Based on the warning for the dangling else, I
      also decided to fix the case where MAX_NUMNODES == 1 by moving the
      condition inside the for loop.  It will still only be tested once.  This
      ensures that the meaning of an else following for_each_node_mask or
      derivatives would not silently have a different meaning depending on the
      configuration.
      
      Link: https://lkml.kernel.org/r/20220414150855.2407137-3-dinechin@redhat.comSigned-off-by: NChristophe de Dinechin <christophe@dinechin.org>
      Signed-off-by: NChristophe de Dinechin <dinechin@redhat.com>
      Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Ben Segall <bsegall@google.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
      Cc: Vincent Guittot <vincent.guittot@linaro.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Zhen Lei <thunder.leizhen@huawei.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      37462a92
    • Q
      mm: fix missing handler for __GFP_NOWARN · 3f913fc5
      Qi Zheng 提交于
      We expect no warnings to be issued when we specify __GFP_NOWARN, but
      currently in paths like alloc_pages() and kmalloc(), there are still some
      warnings printed, fix it.
      
      But for some warnings that report usage problems, we don't deal with them.
      If such warnings are printed, then we should fix the usage problems. 
      Such as the following case:
      
      	WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1));
      
      [zhengqi.arch@bytedance.com: v2]
       Link: https://lkml.kernel.org/r/20220511061951.1114-1-zhengqi.arch@bytedance.com
      Link: https://lkml.kernel.org/r/20220510113809.80626-1-zhengqi.arch@bytedance.comSigned-off-by: NQi Zheng <zhengqi.arch@bytedance.com>
      Cc: Akinobu Mita <akinobu.mita@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jirislaby@kernel.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      3f913fc5
    • W
      mm/page_alloc: fix tracepoint mm_page_alloc_zone_locked() · 10e0f753
      Wonhyuk Yang 提交于
      Currently, trace point mm_page_alloc_zone_locked() doesn't show correct
      information.
      
      First, when alloc_flag has ALLOC_HARDER/ALLOC_CMA, page can be allocated
      from MIGRATE_HIGHATOMIC/MIGRATE_CMA.  Nevertheless, tracepoint use
      requested migration type not MIGRATE_HIGHATOMIC and MIGRATE_CMA.
      
      Second, after commit 44042b44 ("mm/page_alloc: allow high-order pages
      to be stored on the per-cpu lists") percpu-list can store high order
      pages.  But trace point determine whether it is a refiil of percpu-list by
      comparing requested order and 0.
      
      To handle these problems, make mm_page_alloc_zone_locked() only be called
      by __rmqueue_smallest with correct migration type.  With a new argument
      called percpu_refill, it can show roughly whether it is a refill of
      percpu-list.
      
      Link: https://lkml.kernel.org/r/20220512025307.57924-1-vvghjk1234@gmail.comSigned-off-by: NWonhyuk Yang <vvghjk1234@gmail.com>
      Acked-by: NMel Gorman <mgorman@suse.de>
      Cc: Baik Song An <bsahn@etri.re.kr>
      Cc: Hong Yeon Kim <kimhy@etri.re.kr>
      Cc: Taeung Song <taeung@reallinux.co.kr>
      Cc: <linuxgeek@linuxgeek.io>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      10e0f753
    • F
      mm/page_owner.c: add missing __initdata attribute · 3645b5ec
      Fanjun Kong 提交于
      This patch fixes two issues:
      1. Add __initdata attribute according to include/linux/init.h:
      	For initialized data:
      	You should insert __initdata between the variable name and equal
      	sign followed by value
      
      2. Fix below error reported by checkpatch.pl:
      	ERROR: do not initialise statics to false
      
      Special thanks to Muchun Song :)
      
      Link: https://lkml.kernel.org/r/20220516030039.1487005-1-bh1scw@gmail.comSigned-off-by: NFanjun Kong <bh1scw@gmail.com>
      Suggested-by: NMuchun Song <songmuchun@bytedance.com>
      Reviewed-by: NMuchun Song <songmuchun@bytedance.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      3645b5ec
    • L
      tmpfs: fix undefined-behaviour in shmem_reconfigure() · d14f5efa
      Luo Meng 提交于
      When shmem_reconfigure() calls __percpu_counter_compare(), the second
      parameter is unsigned long long.  But in the definition of
      __percpu_counter_compare(), the second parameter is s64.  So when
      __percpu_counter_compare() executes abs(count - rhs), UBSAN shows the
      following warning:
      
      ================================================================================
      UBSAN: Undefined behaviour in lib/percpu_counter.c:209:6
      signed integer overflow:
      0 - -9223372036854775808 cannot be represented in type 'long long int'
      CPU: 1 PID: 9636 Comm: syz-executor.2 Tainted: G                 ---------r-  - 4.18.0 #2
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
      Call Trace:
       __dump_stack home/install/linux-rh-3-10/lib/dump_stack.c:77 [inline]
       dump_stack+0x125/0x1ae home/install/linux-rh-3-10/lib/dump_stack.c:117
       ubsan_epilogue+0xe/0x81 home/install/linux-rh-3-10/lib/ubsan.c:159
       handle_overflow+0x19d/0x1ec home/install/linux-rh-3-10/lib/ubsan.c:190
       __percpu_counter_compare+0x124/0x140 home/install/linux-rh-3-10/lib/percpu_counter.c:209
       percpu_counter_compare home/install/linux-rh-3-10/./include/linux/percpu_counter.h:50 [inline]
       shmem_remount_fs+0x1ce/0x6b0 home/install/linux-rh-3-10/mm/shmem.c:3530
       do_remount_sb+0x11b/0x530 home/install/linux-rh-3-10/fs/super.c:888
       do_remount home/install/linux-rh-3-10/fs/namespace.c:2344 [inline]
       do_mount+0xf8d/0x26b0 home/install/linux-rh-3-10/fs/namespace.c:2844
       ksys_mount+0xad/0x120 home/install/linux-rh-3-10/fs/namespace.c:3075
       __do_sys_mount home/install/linux-rh-3-10/fs/namespace.c:3089 [inline]
       __se_sys_mount home/install/linux-rh-3-10/fs/namespace.c:3086 [inline]
       __x64_sys_mount+0xbf/0x160 home/install/linux-rh-3-10/fs/namespace.c:3086
       do_syscall_64+0xca/0x5c0 home/install/linux-rh-3-10/arch/x86/entry/common.c:298
       entry_SYSCALL_64_after_hwframe+0x6a/0xdf
      RIP: 0033:0x46b5e9
      Code: 5d db fa ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b db fa ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007f54d5f22c68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
      RAX: ffffffffffffffda RBX: 000000000077bf60 RCX: 000000000046b5e9
      RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000000
      RBP: 000000000077bf60 R08: 0000000020000140 R09: 0000000000000000
      R10: 00000000026740a4 R11: 0000000000000246 R12: 0000000000000000
      R13: 00007ffd1fb1592f R14: 00007f54d5f239c0 R15: 000000000077bf6c
      ================================================================================
      
      [akpm@linux-foundation.org: tweak error message text]
      Link: https://lkml.kernel.org/r/20220513025225.2678727-1-luomeng12@huawei.comSigned-off-by: NLuo Meng <luomeng12@huawei.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Yu Kuai <yukuai3@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      d14f5efa