···7070Baolin Wang <baolin.wang@linux.alibaba.com> <baolin.wang7@gmail.com>7171Bart Van Assche <bvanassche@acm.org> <bart.vanassche@sandisk.com>7272Bart Van Assche <bvanassche@acm.org> <bart.vanassche@wdc.com>7373+Ben Dooks <ben-linux@fluff.org> <ben.dooks@simtec.co.uk>7474+Ben Dooks <ben-linux@fluff.org> <ben.dooks@sifive.com>7375Ben Gardner <bgardner@wabtec.com>7476Ben M Cahill <ben.m.cahill@intel.com>7577Ben Widawsky <bwidawsk@kernel.org> <ben@bwidawsk.net>···235233Johan Hovold <johan@kernel.org> <jhovold@gmail.com>236234Johan Hovold <johan@kernel.org> <johan@hovoldconsulting.com>237235John Crispin <john@phrozen.org> <blogic@openwrt.org>236236+John Keeping <john@keeping.me.uk> <john@metanate.com>238237John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>239238John Stultz <johnstul@us.ibm.com>240239<jon.toppins+linux@gmail.com> <jtoppins@cumulusnetworks.com>
+32-32
Documentation/trace/histogram.rst
···3535 in place of an explicit value field - this is simply a count of3636 event hits. If 'values' isn't specified, an implicit 'hitcount'3737 value will be automatically created and used as the only value.3838- Keys can be any field, or the special string 'stacktrace', which3838+ Keys can be any field, or the special string 'common_stacktrace', which3939 will use the event's kernel stacktrace as the key. The keywords4040 'keys' or 'key' can be used to specify keys, and the keywords4141 'values', 'vals', or 'val' can be used to specify values. Compound···5454 'compatible' if the fields named in the trigger share the same5555 number and type of fields and those fields also have the same names.5656 Note that any two events always share the compatible 'hitcount' and5757- 'stacktrace' fields and can therefore be combined using those5757+ 'common_stacktrace' fields and can therefore be combined using those5858 fields, however pointless that may be.59596060 'hist' triggers add a 'hist' file to each event's subdirectory.···547547 the hist trigger display symbolic call_sites, we can have the hist548548 trigger additionally display the complete set of kernel stack traces549549 that led to each call_site. To do that, we simply use the special550550- value 'stacktrace' for the key parameter::550550+ value 'common_stacktrace' for the key parameter::551551552552- # echo 'hist:keys=stacktrace:values=bytes_req,bytes_alloc:sort=bytes_alloc' > \552552+ # echo 'hist:keys=common_stacktrace:values=bytes_req,bytes_alloc:sort=bytes_alloc' > \553553 /sys/kernel/tracing/events/kmem/kmalloc/trigger554554555555 The above trigger will use the kernel stack trace in effect when an···561561 every callpath to a kmalloc for a kernel compile)::562562563563 # cat /sys/kernel/tracing/events/kmem/kmalloc/hist564564- # trigger info: hist:keys=stacktrace:vals=bytes_req,bytes_alloc:sort=bytes_alloc:size=2048 [active]564564+ # trigger info: hist:keys=common_stacktrace:vals=bytes_req,bytes_alloc:sort=bytes_alloc:size=2048 [active]565565566566- { stacktrace:566566+ { common_stacktrace:567567 __kmalloc_track_caller+0x10b/0x1a0568568 kmemdup+0x20/0x50569569 hidraw_report_event+0x8a/0x120 [hid]···581581 cpu_startup_entry+0x315/0x3e0582582 rest_init+0x7c/0x80583583 } hitcount: 3 bytes_req: 21 bytes_alloc: 24584584- { stacktrace:584584+ { common_stacktrace:585585 __kmalloc_track_caller+0x10b/0x1a0586586 kmemdup+0x20/0x50587587 hidraw_report_event+0x8a/0x120 [hid]···596596 do_IRQ+0x5a/0xf0597597 ret_from_intr+0x0/0x30598598 } hitcount: 3 bytes_req: 21 bytes_alloc: 24599599- { stacktrace:599599+ { common_stacktrace:600600 kmem_cache_alloc_trace+0xeb/0x150601601 aa_alloc_task_context+0x27/0x40602602 apparmor_cred_prepare+0x1f/0x50···608608 .609609 .610610 .611611- { stacktrace:611611+ { common_stacktrace:612612 __kmalloc+0x11b/0x1b0613613 i915_gem_execbuffer2+0x6c/0x2c0 [i915]614614 drm_ioctl+0x349/0x670 [drm]···616616 SyS_ioctl+0x81/0xa0617617 system_call_fastpath+0x12/0x6a618618 } hitcount: 17726 bytes_req: 13944120 bytes_alloc: 19593808619619- { stacktrace:619619+ { common_stacktrace:620620 __kmalloc+0x11b/0x1b0621621 load_elf_phdrs+0x76/0xa0622622 load_elf_binary+0x102/0x1650···625625 SyS_execve+0x3a/0x50626626 return_from_execve+0x0/0x23627627 } hitcount: 33348 bytes_req: 17152128 bytes_alloc: 20226048628628- { stacktrace:628628+ { common_stacktrace:629629 kmem_cache_alloc_trace+0xeb/0x150630630 apparmor_file_alloc_security+0x27/0x40631631 security_file_alloc+0x16/0x20···636636 SyS_open+0x1e/0x20637637 system_call_fastpath+0x12/0x6a638638 } hitcount: 4766422 bytes_req: 9532844 bytes_alloc: 38131376639639- { stacktrace:639639+ { common_stacktrace:640640 __kmalloc+0x11b/0x1b0641641 seq_buf_alloc+0x1b/0x50642642 seq_read+0x2cc/0x370···10261026 First we set up an initially paused stacktrace trigger on the10271027 netif_receive_skb event::1028102810291029- # echo 'hist:key=stacktrace:vals=len:pause' > \10291029+ # echo 'hist:key=common_stacktrace:vals=len:pause' > \10301030 /sys/kernel/tracing/events/net/netif_receive_skb/trigger1031103110321032 Next, we set up an 'enable_hist' trigger on the sched_process_exec···10601060 $ wget https://www.kernel.org/pub/linux/kernel/v3.x/patch-3.19.xz1061106110621062 # cat /sys/kernel/tracing/events/net/netif_receive_skb/hist10631063- # trigger info: hist:keys=stacktrace:vals=len:sort=hitcount:size=2048 [paused]10631063+ # trigger info: hist:keys=common_stacktrace:vals=len:sort=hitcount:size=2048 [paused]1064106410651065- { stacktrace:10651065+ { common_stacktrace:10661066 __netif_receive_skb_core+0x46d/0x99010671067 __netif_receive_skb+0x18/0x6010681068 netif_receive_skb_internal+0x23/0x90···10791079 kthread+0xd2/0xf010801080 ret_from_fork+0x42/0x7010811081 } hitcount: 85 len: 2888410821082- { stacktrace:10821082+ { common_stacktrace:10831083 __netif_receive_skb_core+0x46d/0x99010841084 __netif_receive_skb+0x18/0x6010851085 netif_receive_skb_internal+0x23/0x90···10971097 irq_thread+0x11f/0x15010981098 kthread+0xd2/0xf010991099 } hitcount: 98 len: 66432911001100- { stacktrace:11001100+ { common_stacktrace:11011101 __netif_receive_skb_core+0x46d/0x99011021102 __netif_receive_skb+0x18/0x6011031103 process_backlog+0xa8/0x150···11151115 inet_sendmsg+0x64/0xa011161116 sock_sendmsg+0x3d/0x5011171117 } hitcount: 115 len: 1303011181118- { stacktrace:11181118+ { common_stacktrace:11191119 __netif_receive_skb_core+0x46d/0x99011201120 __netif_receive_skb+0x18/0x6011211121 netif_receive_skb_internal+0x23/0x90···11421142 into the histogram. In order to avoid having to set everything up11431143 again, we can just clear the histogram first::1144114411451145- # echo 'hist:key=stacktrace:vals=len:clear' >> \11451145+ # echo 'hist:key=common_stacktrace:vals=len:clear' >> \11461146 /sys/kernel/tracing/events/net/netif_receive_skb/trigger1147114711481148 Just to verify that it is in fact cleared, here's what we now see in11491149 the hist file::1150115011511151 # cat /sys/kernel/tracing/events/net/netif_receive_skb/hist11521152- # trigger info: hist:keys=stacktrace:vals=len:sort=hitcount:size=2048 [paused]11521152+ # trigger info: hist:keys=common_stacktrace:vals=len:sort=hitcount:size=2048 [paused]1153115311541154 Totals:11551155 Hits: 0···1485148514861486 And here's an example that shows how to combine histogram data from14871487 any two events even if they don't share any 'compatible' fields14881488- other than 'hitcount' and 'stacktrace'. These commands create a14881488+ other than 'hitcount' and 'common_stacktrace'. These commands create a14891489 couple of triggers named 'bar' using those fields::1490149014911491- # echo 'hist:name=bar:key=stacktrace:val=hitcount' > \14911491+ # echo 'hist:name=bar:key=common_stacktrace:val=hitcount' > \14921492 /sys/kernel/tracing/events/sched/sched_process_fork/trigger14931493- # echo 'hist:name=bar:key=stacktrace:val=hitcount' > \14931493+ # echo 'hist:name=bar:key=common_stacktrace:val=hitcount' > \14941494 /sys/kernel/tracing/events/net/netif_rx/trigger1495149514961496 And displaying the output of either shows some interesting if···1501150115021502 # event histogram15031503 #15041504- # trigger info: hist:name=bar:keys=stacktrace:vals=hitcount:sort=hitcount:size=2048 [active]15041504+ # trigger info: hist:name=bar:keys=common_stacktrace:vals=hitcount:sort=hitcount:size=2048 [active]15051505 #1506150615071507- { stacktrace:15071507+ { common_stacktrace:15081508 kernel_clone+0x18e/0x33015091509 kernel_thread+0x29/0x3015101510 kthreadd+0x154/0x1b015111511 ret_from_fork+0x3f/0x7015121512 } hitcount: 115131513- { stacktrace:15131513+ { common_stacktrace:15141514 netif_rx_internal+0xb2/0xd015151515 netif_rx_ni+0x20/0x7015161516 dev_loopback_xmit+0xaa/0xd0···15281528 call_cpuidle+0x3b/0x6015291529 cpu_startup_entry+0x22d/0x31015301530 } hitcount: 115311531- { stacktrace:15311531+ { common_stacktrace:15321532 netif_rx_internal+0xb2/0xd015331533 netif_rx_ni+0x20/0x7015341534 dev_loopback_xmit+0xaa/0xd0···15431543 SyS_sendto+0xe/0x1015441544 entry_SYSCALL_64_fastpath+0x12/0x6a15451545 } hitcount: 215461546- { stacktrace:15461546+ { common_stacktrace:15471547 netif_rx_internal+0xb2/0xd015481548 netif_rx+0x1c/0x6015491549 loopback_xmit+0x6c/0xb0···15611561 sock_sendmsg+0x38/0x5015621562 ___sys_sendmsg+0x14e/0x27015631563 } hitcount: 7615641564- { stacktrace:15641564+ { common_stacktrace:15651565 netif_rx_internal+0xb2/0xd015661566 netif_rx+0x1c/0x6015671567 loopback_xmit+0x6c/0xb0···15791579 sock_sendmsg+0x38/0x5015801580 ___sys_sendmsg+0x269/0x27015811581 } hitcount: 7715821582- { stacktrace:15821582+ { common_stacktrace:15831583 netif_rx_internal+0xb2/0xd015841584 netif_rx+0x1c/0x6015851585 loopback_xmit+0x6c/0xb0···15971597 sock_sendmsg+0x38/0x5015981598 SYSC_sendto+0xef/0x17015991599 } hitcount: 8816001600- { stacktrace:16001600+ { common_stacktrace:16011601 kernel_clone+0x18e/0x33016021602 SyS_clone+0x19/0x2016031603 entry_SYSCALL_64_fastpath+0x12/0x6a···1949194919501950 # cd /sys/kernel/tracing19511951 # echo 's:block_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events19521952- # echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=stacktrace if prev_state == 2' >> events/sched/sched_switch/trigger19521952+ # echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=common_stacktrace if prev_state == 2' >> events/sched/sched_switch/trigger19531953 # echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,s=$st:onmax($delta).trace(block_lat,prev_pid,$delta,$s)' >> events/sched/sched_switch/trigger19541954 # echo 1 > events/synthetic/block_lat/enable19551955 # cat trace
+5
arch/powerpc/purgatory/Makefile
···5566targets += trampoline_$(BITS).o purgatory.ro7788+# When profile-guided optimization is enabled, llvm emits two different99+# overlapping text sections, which is not supported by kexec. Remove profile1010+# optimization flags.1111+KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS))1212+813LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined9141015$(obj)/purgatory.ro: $(obj)/trampoline_$(BITS).o FORCE
+5
arch/riscv/purgatory/Makefile
···3535CFLAGS_string.o := -D__DISABLE_EXPORTS3636CFLAGS_ctype.o := -D__DISABLE_EXPORTS37373838+# When profile-guided optimization is enabled, llvm emits two different3939+# overlapping text sections, which is not supported by kexec. Remove profile4040+# optimization flags.4141+KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS))4242+3843# When linking purgatory.ro with -r unresolved symbols are not checked,3944# also link a purgatory.chk binary without -r to check for unresolved symbols.4045PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib
···14141515CFLAGS_sha256.o := -D__DISABLE_EXPORTS16161717+# When profile-guided optimization is enabled, llvm emits two different1818+# overlapping text sections, which is not supported by kexec. Remove profile1919+# optimization flags.2020+KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS))2121+1722# When linking purgatory.ro with -r unresolved symbols are not checked,1823# also link a purgatory.chk binary without -r to check for unresolved symbols.1924PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib
···11021102 NULL,11031103 src_addr, dst_addr,11041104 xt, xt->sgl);11051105+ if (!first)11061106+ return NULL;1105110711061108 /* Length of the block is (BLEN+1) microblocks. */11071109 for (i = 0; i < xt->numf - 1; i++)···11341132 src_addr, dst_addr,11351133 xt, chunk);11361134 if (!desc) {11371137- list_splice_tail_init(&first->descs_list,11381138- &atchan->free_descs_list);11351135+ if (first)11361136+ list_splice_tail_init(&first->descs_list,11371137+ &atchan->free_descs_list);11391138 return NULL;11401139 }11411140
-1
drivers/dma/idxd/cdev.c
···277277 if (wq_dedicated(wq)) {278278 rc = idxd_wq_set_pasid(wq, pasid);279279 if (rc < 0) {280280- iommu_sva_unbind_device(sva);281280 dev_err(dev, "wq set pasid failed: %d\n", rc);282281 goto failed_set_pasid;283282 }
+4-4
drivers/dma/pl330.c
···10501050 return true;10511051}1052105210531053-static bool _start(struct pl330_thread *thrd)10531053+static bool pl330_start_thread(struct pl330_thread *thrd)10541054{10551055 switch (_state(thrd)) {10561056 case PL330_STATE_FAULT_COMPLETING:···17021702 thrd->req_running = -1;1703170317041704 /* Get going again ASAP */17051705- _start(thrd);17051705+ pl330_start_thread(thrd);1706170617071707 /* For now, just make a list of callbacks to be done */17081708 list_add_tail(&descdone->rqd, &pl330->req_done);···20892089 } else {20902090 /* Make sure the PL330 Channel thread is active */20912091 spin_lock(&pch->thread->dmac->lock);20922092- _start(pch->thread);20922092+ pl330_start_thread(pch->thread);20932093 spin_unlock(&pch->thread->dmac->lock);20942094 }20952095···21072107 if (power_down) {21082108 pch->active = true;21092109 spin_lock(&pch->thread->dmac->lock);21102110- _start(pch->thread);21102110+ pl330_start_thread(pch->thread);21112111 spin_unlock(&pch->thread->dmac->lock);21122112 power_down = false;21132113 }
···18281828 * Replacement block manager (new_bm) is created and old_bm destroyed outside of18291829 * cmd root_lock to avoid ABBA deadlock that would result (due to life-cycle of18301830 * shrinker associated with the block manager's bufio client vs cmd root_lock).18311831- * - must take shrinker_mutex without holding cmd->root_lock18311831+ * - must take shrinker_rwsem without holding cmd->root_lock18321832 */18331833 new_bm = dm_block_manager_create(cmd->bdev, DM_CACHE_METADATA_BLOCK_SIZE << SECTOR_SHIFT,18341834 CACHE_MAX_CONCURRENT_LOCKS);
+1-1
drivers/md/dm-thin-metadata.c
···18871887 * Replacement block manager (new_bm) is created and old_bm destroyed outside of18881888 * pmd root_lock to avoid ABBA deadlock that would result (due to life-cycle of18891889 * shrinker associated with the block manager's bufio client vs pmd root_lock).18901890- * - must take shrinker_mutex without holding pmd->root_lock18901890+ * - must take shrinker_rwsem without holding pmd->root_lock18911891 */18921892 new_bm = dm_block_manager_create(pmd->bdev, THIN_METADATA_BLOCK_SIZE << SECTOR_SHIFT,18931893 THIN_MAX_CONCURRENT_LOCKS);
···24722472 ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);24732473 if (ret) {24742474 dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret);24752475- goto err_unlock;24752475+ goto err_decrement_count;24762476 }2477247724782478 ret = reset_control_bulk_assert(cfg->num_resets, qmp->resets);···25222522 reset_control_bulk_assert(cfg->num_resets, qmp->resets);25232523err_disable_regulators:25242524 regulator_bulk_disable(cfg->num_vregs, qmp->vregs);25252525-err_unlock:25252525+err_decrement_count:25262526+ qmp->init_count--;25262527 mutex_unlock(&qmp->phy_mutex);2527252825282529 return ret;
+3-2
drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c
···379379 ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);380380 if (ret) {381381 dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret);382382- goto err_unlock;382382+ goto err_decrement_count;383383 }384384385385 ret = reset_control_bulk_assert(cfg->num_resets, qmp->resets);···409409 reset_control_bulk_assert(cfg->num_resets, qmp->resets);410410err_disable_regulators:411411 regulator_bulk_disable(cfg->num_vregs, qmp->vregs);412412-err_unlock:412412+err_decrement_count:413413+ qmp->init_count--;413414 mutex_unlock(&qmp->phy_mutex);414415415416 return ret;
+1-1
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
···115115 *116116 * @cfg_ahb_clk: AHB2PHY interface clock117117 * @ref_clk: phy reference clock118118- * @iface_clk: phy interface clock119118 * @phy_reset: phy reset control120119 * @vregs: regulator supplies bulk data121120 * @phy_initialized: if PHY has been initialized correctly122121 * @mode: contains the current mode the PHY is in122122+ * @update_seq_cfg: tuning parameters for phy init123123 */124124struct qcom_snps_hsphy {125125 struct phy *phy;
+5-1
fs/eventpoll.c
···18051805{18061806 int ret = default_wake_function(wq_entry, mode, sync, key);1807180718081808- list_del_init(&wq_entry->entry);18081808+ /*18091809+ * Pairs with list_empty_careful in ep_poll, and ensures future loop18101810+ * iterations see the cause of this wakeup.18111811+ */18121812+ list_del_init_careful(&wq_entry->entry);18091813 return ret;18101814}18111815
+10-2
fs/nilfs2/btnode.c
···285285 if (nbh == NULL) { /* blocksize == pagesize */286286 xa_erase_irq(&btnc->i_pages, newkey);287287 unlock_page(ctxt->bh->b_page);288288- } else289289- brelse(nbh);288288+ } else {289289+ /*290290+ * When canceling a buffer that a prepare operation has291291+ * allocated to copy a node block to another location, use292292+ * nilfs_btnode_delete() to initialize and release the buffer293293+ * so that the buffer flags will not be in an inconsistent294294+ * state when it is reallocated.295295+ */296296+ nilfs_btnode_delete(nbh);297297+ }290298}
+9-1
fs/nilfs2/page.c
···370370 struct folio *folio = fbatch.folios[i];371371372372 folio_lock(folio);373373- nilfs_clear_dirty_page(&folio->page, silent);373373+374374+ /*375375+ * This folio may have been removed from the address376376+ * space by truncation or invalidation when the lock377377+ * was acquired. Skip processing in that case.378378+ */379379+ if (likely(folio->mapping == mapping))380380+ nilfs_clear_dirty_page(&folio->page, silent);381381+374382 folio_unlock(folio);375383 }376384 folio_batch_release(&fbatch);
+6
fs/nilfs2/segbuf.c
···101101 if (unlikely(!bh))102102 return -ENOMEM;103103104104+ lock_buffer(bh);105105+ if (!buffer_uptodate(bh)) {106106+ memset(bh->b_data, 0, bh->b_size);107107+ set_buffer_uptodate(bh);108108+ }109109+ unlock_buffer(bh);104110 nilfs_segbuf_add_segsum_buffer(segbuf, bh);105111 return 0;106112}
···779779 goto out_header;780780781781 sui->ncleansegs -= nsegs - newnsegs;782782+783783+ /*784784+ * If the sufile is successfully truncated, immediately adjust785785+ * the segment allocation space while locking the semaphore786786+ * "mi_sem" so that nilfs_sufile_alloc() never allocates787787+ * segments in the truncated space.788788+ */789789+ sui->allocmax = newnsegs - 1;790790+ sui->allocmin = 0;782791 }783792784793 kaddr = kmap_atomic(header_bh->b_page);
+23-2
fs/nilfs2/super.c
···372372 goto out;373373 }374374 nsbp = (void *)nsbh->b_data + offset;375375- memset(nsbp, 0, nilfs->ns_blocksize);375375+376376+ lock_buffer(nsbh);377377+ if (sb2i >= 0) {378378+ /*379379+ * The position of the second superblock only changes by 4KiB,380380+ * which is larger than the maximum superblock data size381381+ * (= 1KiB), so there is no need to use memmove() to allow382382+ * overlap between source and destination.383383+ */384384+ memcpy(nsbp, nilfs->ns_sbp[sb2i], nilfs->ns_sbsize);385385+386386+ /*387387+ * Zero fill after copy to avoid overwriting in case of move388388+ * within the same block.389389+ */390390+ memset(nsbh->b_data, 0, offset);391391+ memset((void *)nsbp + nilfs->ns_sbsize, 0,392392+ nsbh->b_size - offset - nilfs->ns_sbsize);393393+ } else {394394+ memset(nsbh->b_data, 0, nsbh->b_size);395395+ }396396+ set_buffer_uptodate(nsbh);397397+ unlock_buffer(nsbh);376398377399 if (sb2i >= 0) {378378- memcpy(nsbp, nilfs->ns_sbp[sb2i], nilfs->ns_sbsize);379400 brelse(nilfs->ns_sbh[sb2i]);380401 nilfs->ns_sbh[sb2i] = nsbh;381402 nilfs->ns_sbp[sb2i] = nsbp;
+42-1
fs/nilfs2/the_nilfs.c
···405405 100));406406}407407408408+/**409409+ * nilfs_max_segment_count - calculate the maximum number of segments410410+ * @nilfs: nilfs object411411+ */412412+static u64 nilfs_max_segment_count(struct the_nilfs *nilfs)413413+{414414+ u64 max_count = U64_MAX;415415+416416+ do_div(max_count, nilfs->ns_blocks_per_segment);417417+ return min_t(u64, max_count, ULONG_MAX);418418+}419419+408420void nilfs_set_nsegments(struct the_nilfs *nilfs, unsigned long nsegs)409421{410422 nilfs->ns_nsegments = nsegs;···426414static int nilfs_store_disk_layout(struct the_nilfs *nilfs,427415 struct nilfs_super_block *sbp)428416{417417+ u64 nsegments, nblocks;418418+429419 if (le32_to_cpu(sbp->s_rev_level) < NILFS_MIN_SUPP_REV) {430420 nilfs_err(nilfs->ns_sb,431421 "unsupported revision (superblock rev.=%d.%d, current rev.=%d.%d). Please check the version of mkfs.nilfs(2).",···471457 return -EINVAL;472458 }473459474474- nilfs_set_nsegments(nilfs, le64_to_cpu(sbp->s_nsegments));460460+ nsegments = le64_to_cpu(sbp->s_nsegments);461461+ if (nsegments > nilfs_max_segment_count(nilfs)) {462462+ nilfs_err(nilfs->ns_sb,463463+ "segment count %llu exceeds upper limit (%llu segments)",464464+ (unsigned long long)nsegments,465465+ (unsigned long long)nilfs_max_segment_count(nilfs));466466+ return -EINVAL;467467+ }468468+469469+ nblocks = sb_bdev_nr_blocks(nilfs->ns_sb);470470+ if (nblocks) {471471+ u64 min_block_count = nsegments * nilfs->ns_blocks_per_segment;472472+ /*473473+ * To avoid failing to mount early device images without a474474+ * second superblock, exclude that block count from the475475+ * "min_block_count" calculation.476476+ */477477+478478+ if (nblocks < min_block_count) {479479+ nilfs_err(nilfs->ns_sb,480480+ "total number of segment blocks %llu exceeds device size (%llu blocks)",481481+ (unsigned long long)min_block_count,482482+ (unsigned long long)nblocks);483483+ return -EINVAL;484484+ }485485+ }486486+487487+ nilfs_set_nsegments(nilfs, nsegments);475488 nilfs->ns_crc_seed = le32_to_cpu(sbp->s_crc_seed);476489 return 0;477490}
+7-1
fs/ocfs2/file.c
···21002100 struct ocfs2_space_resv sr;21012101 int change_size = 1;21022102 int cmd = OCFS2_IOC_RESVSP64;21032103+ int ret = 0;2103210421042105 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))21052106 return -EOPNOTSUPP;21062107 if (!ocfs2_writes_unwritten_extents(osb))21072108 return -EOPNOTSUPP;2108210921092109- if (mode & FALLOC_FL_KEEP_SIZE)21102110+ if (mode & FALLOC_FL_KEEP_SIZE) {21102111 change_size = 0;21122112+ } else {21132113+ ret = inode_newsize_ok(inode, offset + len);21142114+ if (ret)21152115+ return ret;21162116+ }2111211721122118 if (mode & FALLOC_FL_PUNCH_HOLE)21132119 cmd = OCFS2_IOC_UNRESVSP64;
+4-2
fs/ocfs2/super.c
···952952 for (type = 0; type < OCFS2_MAXQUOTAS; type++) {953953 if (!sb_has_quota_loaded(sb, type))954954 continue;955955- oinfo = sb_dqinfo(sb, type)->dqi_priv;956956- cancel_delayed_work_sync(&oinfo->dqi_sync_work);955955+ if (!sb_has_quota_suspended(sb, type)) {956956+ oinfo = sb_dqinfo(sb, type)->dqi_priv;957957+ cancel_delayed_work_sync(&oinfo->dqi_sync_work);958958+ }957959 inode = igrab(sb->s_dquot.files[type]);958960 /* Turn off quotas. This will remove all dquot structures from959961 * memory and so they will be automatically synced to global
+1-1
fs/super.c
···5454 * One thing we have to be careful of with a per-sb shrinker is that we don't5555 * drop the last active reference to the superblock from within the shrinker.5656 * If that happens we could trigger unregistering the shrinker from within the5757- * shrinker path and that leads to deadlock on the shrinker_mutex. Hence we5757+ * shrinker path and that leads to deadlock on the shrinker_rwsem. Hence we5858 * take a passive reference to the superblock to avoid this from occurring.5959 */6060static unsigned long super_cache_scan(struct shrinker *shrink,
···901901 }902902903903 offset = ALIGN(offset, align);904904+905905+ /*906906+ * Check if the segment contains the entry point, if so,907907+ * calculate the value of image->start based on it.908908+ * If the compiler has produced more than one .text section909909+ * (Eg: .text.hot), they are generally after the main .text910910+ * section, and they shall not be used to calculate911911+ * image->start. So do not re-calculate image->start if it912912+ * is not set to the initial value, and warn the user so they913913+ * have a chance to fix their purgatory's linker script.914914+ */904915 if (sechdrs[i].sh_flags & SHF_EXECINSTR &&905916 pi->ehdr->e_entry >= sechdrs[i].sh_addr &&906917 pi->ehdr->e_entry < (sechdrs[i].sh_addr907907- + sechdrs[i].sh_size)) {918918+ + sechdrs[i].sh_size) &&919919+ !WARN_ON(kbuf->image->start != pi->ehdr->e_entry)) {908920 kbuf->image->start -= sechdrs[i].sh_addr;909921 kbuf->image->start += kbuf->mem + offset;910922 }
+22-50
kernel/module/main.c
···30573057 return load_module(&info, uargs, 0);30583058}3059305930603060-static int file_init_module(struct file *file, const char __user * uargs, int flags)30603060+SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)30613061{30623062 struct load_info info = { };30633063 void *buf = NULL;30643064 int len;30653065-30663066- len = kernel_read_file(file, 0, &buf, INT_MAX, NULL,30673067- READING_MODULE);30683068- if (len < 0) {30693069- mod_stat_inc(&failed_kreads);30703070- mod_stat_add_long(len, &invalid_kread_bytes);30713071- return len;30723072- }30733073-30743074- if (flags & MODULE_INIT_COMPRESSED_FILE) {30753075- int err = module_decompress(&info, buf, len);30763076- vfree(buf); /* compressed data is no longer needed */30773077- if (err) {30783078- mod_stat_inc(&failed_decompress);30793079- mod_stat_add_long(len, &invalid_decompress_bytes);30803080- return err;30813081- }30823082- } else {30833083- info.hdr = buf;30843084- info.len = len;30853085- }30863086-30873087- return load_module(&info, uargs, flags);30883088-}30893089-30903090-/*30913091- * kernel_read_file() will already deny write access, but module30923092- * loading wants _exclusive_ access to the file, so we do that30933093- * here, along with basic sanity checks.30943094- */30953095-static int prepare_file_for_module_load(struct file *file)30963096-{30973097- if (!file || !(file->f_mode & FMODE_READ))30983098- return -EBADF;30993099- if (!S_ISREG(file_inode(file)->i_mode))31003100- return -EINVAL;31013101- return exclusive_deny_write_access(file);31023102-}31033103-31043104-SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)31053105-{31063106- struct fd f;31073065 int err;3108306631093067 err = may_init_module();···30753117 |MODULE_INIT_COMPRESSED_FILE))30763118 return -EINVAL;3077311930783078- f = fdget(fd);30793079- err = prepare_file_for_module_load(f.file);30803080- if (!err) {30813081- err = file_init_module(f.file, uargs, flags);30823082- allow_write_access(f.file);31203120+ len = kernel_read_file_from_fd(fd, 0, &buf, INT_MAX, NULL,31213121+ READING_MODULE);31223122+ if (len < 0) {31233123+ mod_stat_inc(&failed_kreads);31243124+ mod_stat_add_long(len, &invalid_kread_bytes);31253125+ return len;30833126 }30843084- fdput(f);30853085- return err;31273127+31283128+ if (flags & MODULE_INIT_COMPRESSED_FILE) {31293129+ err = module_decompress(&info, buf, len);31303130+ vfree(buf); /* compressed data is no longer needed */31313131+ if (err) {31323132+ mod_stat_inc(&failed_decompress);31333133+ mod_stat_add_long(len, &invalid_decompress_bytes);31343134+ return err;31353135+ }31363136+ } else {31373137+ info.hdr = buf;31383138+ info.len = len;31393139+ }31403140+31413141+ return load_module(&info, uargs, flags);30863142}3087314330883144/* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
+36-8
kernel/trace/trace.c
···6060 */6161bool ring_buffer_expanded;62626363+#ifdef CONFIG_FTRACE_STARTUP_TEST6364/*6465 * We need to change this state when a selftest is running.6566 * A selftest will lurk into the ring-buffer to count the···7675 */7776bool __read_mostly tracing_selftest_disabled;78777979-#ifdef CONFIG_FTRACE_STARTUP_TEST8078void __init disable_tracing_selftest(const char *reason)8179{8280 if (!tracing_selftest_disabled) {···8383 pr_info("Ftrace startup test is disabled due to %s\n", reason);8484 }8585}8686+#else8787+#define tracing_selftest_running 08888+#define tracing_selftest_disabled 08689#endif87908891/* Pipe tracepoints to printk */···10541051 if (!(tr->trace_flags & TRACE_ITER_PRINTK))10551052 return 0;1056105310571057- if (unlikely(tracing_selftest_running || tracing_disabled))10541054+ if (unlikely(tracing_selftest_running && tr == &global_trace))10551055+ return 0;10561056+10571057+ if (unlikely(tracing_disabled))10581058 return 0;1059105910601060 alloc = sizeof(*entry) + size + 2; /* possible \n added */···20472041 return 0;20482042}2049204320442044+static int do_run_tracer_selftest(struct tracer *type)20452045+{20462046+ int ret;20472047+20482048+ /*20492049+ * Tests can take a long time, especially if they are run one after the20502050+ * other, as does happen during bootup when all the tracers are20512051+ * registered. This could cause the soft lockup watchdog to trigger.20522052+ */20532053+ cond_resched();20542054+20552055+ tracing_selftest_running = true;20562056+ ret = run_tracer_selftest(type);20572057+ tracing_selftest_running = false;20582058+20592059+ return ret;20602060+}20612061+20502062static __init int init_trace_selftests(void)20512063{20522064 struct trace_selftests *p, *n;···21162092{21172093 return 0;21182094}20952095+static inline int do_run_tracer_selftest(struct tracer *type)20962096+{20972097+ return 0;20982098+}21192099#endif /* CONFIG_FTRACE_STARTUP_TEST */2120210021212101static void add_tracer_options(struct trace_array *tr, struct tracer *t);···2155212721562128 mutex_lock(&trace_types_lock);2157212921582158- tracing_selftest_running = true;21592159-21602130 for (t = trace_types; t; t = t->next) {21612131 if (strcmp(type->name, t->name) == 0) {21622132 /* already found */···21832157 /* store the tracer for __set_tracer_option */21842158 type->flags->trace = type;2185215921862186- ret = run_tracer_selftest(type);21602160+ ret = do_run_tracer_selftest(type);21872161 if (ret < 0)21882162 goto out;21892163···21922166 add_tracer_options(&global_trace, type);2193216721942168 out:21952195- tracing_selftest_running = false;21962169 mutex_unlock(&trace_types_lock);2197217021982171 if (ret || !default_bootup_tracer)···35153490 unsigned int trace_ctx;35163491 char *tbuffer;3517349235183518- if (tracing_disabled || tracing_selftest_running)34933493+ if (tracing_disabled)35193494 return 0;3520349535213496 /* Don't pollute graph traces with trace_vprintk internals */···35633538int trace_array_vprintk(struct trace_array *tr,35643539 unsigned long ip, const char *fmt, va_list args)35653540{35413541+ if (tracing_selftest_running && tr == &global_trace)35423542+ return 0;35433543+35663544 return __trace_array_vprintk(tr->array_buffer.buffer, ip, fmt, args);35673545}35683546···57805752 "\t table using the key(s) and value(s) named, and the value of a\n"57815753 "\t sum called 'hitcount' is incremented. Keys and values\n"57825754 "\t correspond to fields in the event's format description. Keys\n"57835783- "\t can be any field, or the special string 'stacktrace'.\n"57555755+ "\t can be any field, or the special string 'common_stacktrace'.\n"57845756 "\t Compound keys consisting of up to two fields can be specified\n"57855757 "\t by the 'keys' keyword. Values must correspond to numeric\n"57865758 "\t fields. Sort keys consisting of up to two fields can be\n"
···13641364 if (field->field)13651365 field_name = field->field->name;13661366 else13671367- field_name = "stacktrace";13671367+ field_name = "common_stacktrace";13681368 } else if (field->flags & HIST_FIELD_FL_HITCOUNT)13691369 field_name = "hitcount";13701370···23672367 hist_data->enable_timestamps = true;23682368 if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS)23692369 hist_data->attrs->ts_in_usecs = true;23702370- } else if (strcmp(field_name, "stacktrace") == 0) {23702370+ } else if (strcmp(field_name, "common_stacktrace") == 0) {23712371 *flags |= HIST_FIELD_FL_STACKTRACE;23722372 } else if (strcmp(field_name, "common_cpu") == 0)23732373 *flags |= HIST_FIELD_FL_CPU;···23782378 if (!field || !field->size) {23792379 /*23802380 * For backward compatibility, if field_name23812381- * was "cpu", then we treat this the same as23822382- * common_cpu. This also works for "CPU".23812381+ * was "cpu" or "stacktrace", then we treat this23822382+ * the same as common_cpu and common_stacktrace23832383+ * respectively. This also works for "CPU", and23842384+ * "STACKTRACE".23832385 */23842386 if (field && field->filter_type == FILTER_CPU) {23852387 *flags |= HIST_FIELD_FL_CPU;23882388+ } else if (field && field->filter_type == FILTER_STACKTRACE) {23892389+ *flags |= HIST_FIELD_FL_STACKTRACE;23862390 } else {23872391 hist_err(tr, HIST_ERR_FIELD_NOT_FOUND,23882392 errpos(field_name));···42424238 goto out;42434239 }4244424042454245- /* Some types cannot be a value */42464246- if (hist_field->flags & (HIST_FIELD_FL_GRAPH | HIST_FIELD_FL_PERCENT |42474247- HIST_FIELD_FL_BUCKET | HIST_FIELD_FL_LOG2 |42484248- HIST_FIELD_FL_SYM | HIST_FIELD_FL_SYM_OFFSET |42494249- HIST_FIELD_FL_SYSCALL | HIST_FIELD_FL_STACKTRACE)) {42504250- hist_err(file->tr, HIST_ERR_BAD_FIELD_MODIFIER, errpos(field_str));42514251- ret = -EINVAL;42414241+ /* values and variables should not have some modifiers */42424242+ if (hist_field->flags & HIST_FIELD_FL_VAR) {42434243+ /* Variable */42444244+ if (hist_field->flags & (HIST_FIELD_FL_GRAPH | HIST_FIELD_FL_PERCENT |42454245+ HIST_FIELD_FL_BUCKET | HIST_FIELD_FL_LOG2))42464246+ goto err;42474247+ } else {42484248+ /* Value */42494249+ if (hist_field->flags & (HIST_FIELD_FL_GRAPH | HIST_FIELD_FL_PERCENT |42504250+ HIST_FIELD_FL_BUCKET | HIST_FIELD_FL_LOG2 |42514251+ HIST_FIELD_FL_SYM | HIST_FIELD_FL_SYM_OFFSET |42524252+ HIST_FIELD_FL_SYSCALL | HIST_FIELD_FL_STACKTRACE))42534253+ goto err;42524254 }4253425542544256 hist_data->fields[val_idx] = hist_field;···42664256 ret = -EINVAL;42674257 out:42684258 return ret;42594259+ err:42604260+ hist_err(file->tr, HIST_ERR_BAD_FIELD_MODIFIER, errpos(field_str));42614261+ return -EINVAL;42694262}4270426342714264static int create_val_field(struct hist_trigger_data *hist_data,···53985385 if (key_field->field)53995386 seq_printf(m, "%s.stacktrace", key_field->field->name);54005387 else54015401- seq_puts(m, "stacktrace:\n");53885388+ seq_puts(m, "common_stacktrace:\n");54025389 hist_trigger_stacktrace_print(m,54035390 key + key_field->offset,54045391 HIST_STACKTRACE_DEPTH);···59815968 if (field->field)59825969 seq_printf(m, "%s.stacktrace", field->field->name);59835970 else59845984- seq_puts(m, "stacktrace");59715971+ seq_puts(m, "common_stacktrace");59855972 } else59865973 hist_field_print(m, field);59875974 }
+73-39
kernel/trace/trace_events_user.c
···9696 * these to track enablement sites that are tied to an event.9797 */9898struct user_event_enabler {9999- struct list_head link;9999+ struct list_head mm_enablers_link;100100 struct user_event *event;101101 unsigned long addr;102102103103 /* Track enable bit, flags, etc. Aligned for bitops. */104104- unsigned int values;104104+ unsigned long values;105105};106106107107/* Bits 0-5 are for the bit to update upon enable/disable (0-63 allowed) */···116116/* Only duplicate the bit value */117117#define ENABLE_VAL_DUP_MASK ENABLE_VAL_BIT_MASK118118119119-#define ENABLE_BITOPS(e) ((unsigned long *)&(e)->values)119119+#define ENABLE_BITOPS(e) (&(e)->values)120120+121121+#define ENABLE_BIT(e) ((int)((e)->values & ENABLE_VAL_BIT_MASK))120122121123/* Used for asynchronous faulting in of pages */122124struct user_event_enabler_fault {···155153#define VALIDATOR_REL (1 << 1)156154157155struct user_event_validator {158158- struct list_head link;156156+ struct list_head user_event_link;159157 int offset;160158 int flags;161159};···261259262260static void user_event_enabler_destroy(struct user_event_enabler *enabler)263261{264264- list_del_rcu(&enabler->link);262262+ list_del_rcu(&enabler->mm_enablers_link);265263266264 /* No longer tracking the event via the enabler */267265 refcount_dec(&enabler->event->refcnt);···425423426424 /* Update bit atomically, user tracers must be atomic as well */427425 if (enabler->event && enabler->event->status)428428- set_bit(enabler->values & ENABLE_VAL_BIT_MASK, ptr);426426+ set_bit(ENABLE_BIT(enabler), ptr);429427 else430430- clear_bit(enabler->values & ENABLE_VAL_BIT_MASK, ptr);428428+ clear_bit(ENABLE_BIT(enabler), ptr);431429432430 kunmap_local(kaddr);433431 unpin_user_pages_dirty_lock(&page, 1, true);···439437 unsigned long uaddr, unsigned char bit)440438{441439 struct user_event_enabler *enabler;442442- struct user_event_enabler *next;443440444444- list_for_each_entry_safe(enabler, next, &mm->enablers, link) {445445- if (enabler->addr == uaddr &&446446- (enabler->values & ENABLE_VAL_BIT_MASK) == bit)441441+ list_for_each_entry(enabler, &mm->enablers, mm_enablers_link) {442442+ if (enabler->addr == uaddr && ENABLE_BIT(enabler) == bit)447443 return true;448444 }449445···451451static void user_event_enabler_update(struct user_event *user)452452{453453 struct user_event_enabler *enabler;454454- struct user_event_mm *mm = user_event_mm_get_all(user);455454 struct user_event_mm *next;455455+ struct user_event_mm *mm;456456 int attempt;457457+458458+ lockdep_assert_held(&event_mutex);459459+460460+ /*461461+ * We need to build a one-shot list of all the mms that have an462462+ * enabler for the user_event passed in. This list is only valid463463+ * while holding the event_mutex. The only reason for this is due464464+ * to the global mm list being RCU protected and we use methods465465+ * which can wait (mmap_read_lock and pin_user_pages_remote).466466+ *467467+ * NOTE: user_event_mm_get_all() increments the ref count of each468468+ * mm that is added to the list to prevent removal timing windows.469469+ * We must always put each mm after they are used, which may wait.470470+ */471471+ mm = user_event_mm_get_all(user);457472458473 while (mm) {459474 next = mm->next;460475 mmap_read_lock(mm->mm);461461- rcu_read_lock();462476463463- list_for_each_entry_rcu(enabler, &mm->enablers, link) {477477+ list_for_each_entry(enabler, &mm->enablers, mm_enablers_link) {464478 if (enabler->event == user) {465479 attempt = 0;466480 user_event_enabler_write(mm, enabler, true, &attempt);467481 }468482 }469483470470- rcu_read_unlock();471484 mmap_read_unlock(mm->mm);472485 user_event_mm_put(mm);473486 mm = next;···508495 enabler->values = orig->values & ENABLE_VAL_DUP_MASK;509496510497 refcount_inc(&enabler->event->refcnt);511511- list_add_rcu(&enabler->link, &mm->enablers);498498+499499+ /* Enablers not exposed yet, RCU not required */500500+ list_add(&enabler->mm_enablers_link, &mm->enablers);512501513502 return true;514503}···529514 struct user_event_mm *mm;530515531516 /*517517+ * We use the mm->next field to build a one-shot list from the global518518+ * RCU protected list. To build this list the event_mutex must be held.519519+ * This lets us build a list without requiring allocs that could fail520520+ * when user based events are most wanted for diagnostics.521521+ */522522+ lockdep_assert_held(&event_mutex);523523+524524+ /*532525 * We do not want to block fork/exec while enablements are being533526 * updated, so we use RCU to walk the current tasks that have used534527 * user_events ABI for 1 or more events. Each enabler found in each···548525 */549526 rcu_read_lock();550527551551- list_for_each_entry_rcu(mm, &user_event_mms, link)552552- list_for_each_entry_rcu(enabler, &mm->enablers, link)528528+ list_for_each_entry_rcu(mm, &user_event_mms, mms_link) {529529+ list_for_each_entry_rcu(enabler, &mm->enablers, mm_enablers_link) {553530 if (enabler->event == user) {554531 mm->next = found;555532 found = user_event_mm_get(mm);556533 break;557534 }535535+ }536536+ }558537559538 rcu_read_unlock();560539561540 return found;562541}563542564564-static struct user_event_mm *user_event_mm_create(struct task_struct *t)543543+static struct user_event_mm *user_event_mm_alloc(struct task_struct *t)565544{566545 struct user_event_mm *user_mm;567567- unsigned long flags;568546569547 user_mm = kzalloc(sizeof(*user_mm), GFP_KERNEL_ACCOUNT);570548···576552 INIT_LIST_HEAD(&user_mm->enablers);577553 refcount_set(&user_mm->refcnt, 1);578554 refcount_set(&user_mm->tasks, 1);579579-580580- spin_lock_irqsave(&user_event_mms_lock, flags);581581- list_add_rcu(&user_mm->link, &user_event_mms);582582- spin_unlock_irqrestore(&user_event_mms_lock, flags);583583-584584- t->user_event_mm = user_mm;585555586556 /*587557 * The lifetime of the memory descriptor can slightly outlast···590572 return user_mm;591573}592574575575+static void user_event_mm_attach(struct user_event_mm *user_mm, struct task_struct *t)576576+{577577+ unsigned long flags;578578+579579+ spin_lock_irqsave(&user_event_mms_lock, flags);580580+ list_add_rcu(&user_mm->mms_link, &user_event_mms);581581+ spin_unlock_irqrestore(&user_event_mms_lock, flags);582582+583583+ t->user_event_mm = user_mm;584584+}585585+593586static struct user_event_mm *current_user_event_mm(void)594587{595588 struct user_event_mm *user_mm = current->user_event_mm;···608579 if (user_mm)609580 goto inc;610581611611- user_mm = user_event_mm_create(current);582582+ user_mm = user_event_mm_alloc(current);612583613584 if (!user_mm)614585 goto error;586586+587587+ user_event_mm_attach(user_mm, current);615588inc:616589 refcount_inc(&user_mm->refcnt);617590error:···624593{625594 struct user_event_enabler *enabler, *next;626595627627- list_for_each_entry_safe(enabler, next, &mm->enablers, link)596596+ list_for_each_entry_safe(enabler, next, &mm->enablers, mm_enablers_link)628597 user_event_enabler_destroy(enabler);629598630599 mmdrop(mm->mm);···661630662631 /* Remove the mm from the list, so it can no longer be enabled */663632 spin_lock_irqsave(&user_event_mms_lock, flags);664664- list_del_rcu(&mm->link);633633+ list_del_rcu(&mm->mms_link);665634 spin_unlock_irqrestore(&user_event_mms_lock, flags);666635667636 /*···701670702671void user_event_mm_dup(struct task_struct *t, struct user_event_mm *old_mm)703672{704704- struct user_event_mm *mm = user_event_mm_create(t);673673+ struct user_event_mm *mm = user_event_mm_alloc(t);705674 struct user_event_enabler *enabler;706675707676 if (!mm)···709678710679 rcu_read_lock();711680712712- list_for_each_entry_rcu(enabler, &old_mm->enablers, link)681681+ list_for_each_entry_rcu(enabler, &old_mm->enablers, mm_enablers_link) {713682 if (!user_event_enabler_dup(enabler, mm))714683 goto error;684684+ }715685716686 rcu_read_unlock();717687688688+ user_event_mm_attach(mm, t);718689 return;719690error:720691 rcu_read_unlock();721721- user_event_mm_remove(t);692692+ user_event_mm_destroy(mm);722693}723694724695static bool current_user_event_enabler_exists(unsigned long uaddr,···781748 */782749 if (!*write_result) {783750 refcount_inc(&enabler->event->refcnt);784784- list_add_rcu(&enabler->link, &user_mm->enablers);751751+ list_add_rcu(&enabler->mm_enablers_link, &user_mm->enablers);785752 }786753787754 mutex_unlock(&event_mutex);···937904 struct user_event_validator *validator, *next;938905 struct list_head *head = &user->validators;939906940940- list_for_each_entry_safe(validator, next, head, link) {941941- list_del(&validator->link);907907+ list_for_each_entry_safe(validator, next, head, user_event_link) {908908+ list_del(&validator->user_event_link);942909 kfree(validator);943910 }944911}···992959 validator->offset = offset;993960994961 /* Want sequential access when validating */995995- list_add_tail(&validator->link, &user->validators);962962+ list_add_tail(&validator->user_event_link, &user->validators);996963997964add_field:998965 field->type = type;···13821349 void *pos, *end = data + len;13831350 u32 loc, offset, size;1384135113851385- list_for_each_entry(validator, head, link) {13521352+ list_for_each_entry(validator, head, user_event_link) {13861353 pos = data + validator->offset;1387135413881355 /* Already done min_size check, no bounds check here */···23032270 */23042271 mutex_lock(&event_mutex);2305227223062306- list_for_each_entry_safe(enabler, next, &mm->enablers, link)22732273+ list_for_each_entry_safe(enabler, next, &mm->enablers, mm_enablers_link) {23072274 if (enabler->addr == reg.disable_addr &&23082308- (enabler->values & ENABLE_VAL_BIT_MASK) == reg.disable_bit) {22752275+ ENABLE_BIT(enabler) == reg.disable_bit) {23092276 set_bit(ENABLE_VAL_FREEING_BIT, ENABLE_BITOPS(enabler));2310227723112278 if (!test_bit(ENABLE_VAL_FAULTING_BIT, ENABLE_BITOPS(enabler)))···23142281 /* Removed at least one */23152282 ret = 0;23162283 }22842284+ }2317228523182286 mutex_unlock(&event_mutex);23192287
···848848 }849849850850#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS851851+ /*852852+ * These tests can take some time to run. Make sure on non PREEMPT853853+ * kernels, we do not trigger the softlockup detector.854854+ */855855+ cond_resched();856856+851857 tracing_reset_online_cpus(&tr->array_buffer);852858 set_graph_array(tr);853859···874868 (unsigned long)ftrace_stub_direct_tramp);875869 if (ret)876870 goto out;871871+872872+ cond_resched();877873878874 ret = register_ftrace_graph(&fgraph_ops);879875 if (ret) {···898890 true);899891 if (ret)900892 goto out;893893+894894+ cond_resched();901895902896 tracing_start();903897
+2
lib/radix-tree.c
···2727#include <linux/string.h>2828#include <linux/xarray.h>29293030+#include "radix-tree.h"3131+3032/*3133 * Radix tree node cache.3234 */
+8
lib/radix-tree.h
···11+// SPDX-License-Identifier: GPL-2.0+22+/* radix-tree helpers that are only shared with xarray */33+44+struct kmem_cache;55+struct rcu_head;66+77+extern struct kmem_cache *radix_tree_node_cachep;88+extern void radix_tree_node_rcu_free(struct rcu_head *head);
···1212#include <linux/slab.h>1313#include <linux/xarray.h>14141515+#include "radix-tree.h"1616+1517/*1618 * Coding conventions in this file:1719 *···248246 return entry;249247}250248EXPORT_SYMBOL_GPL(xas_load);251251-252252-/* Move the radix tree node cache here */253253-extern struct kmem_cache *radix_tree_node_cachep;254254-extern void radix_tree_node_rcu_free(struct rcu_head *head);255249256250#define XA_RCU_FREE ((struct xarray *)1)257251
+2
mm/damon/core.c
···551551 return -EINVAL;552552 if (attrs->min_nr_regions > attrs->max_nr_regions)553553 return -EINVAL;554554+ if (attrs->sample_interval > attrs->aggr_interval)555555+ return -EINVAL;554556555557 damon_update_monitoring_results(ctx, attrs);556558 ctx->attrs = *attrs;
+16-10
mm/filemap.c
···17281728 *17291729 * Return: The index of the gap if found, otherwise an index outside the17301730 * range specified (in which case 'return - index >= max_scan' will be true).17311731- * In the rare case of index wrap-around, 0 will be returned.17311731+ * In the rare case of index wrap-around, 0 will be returned. 0 will also17321732+ * be returned if index == 0 and there is a gap at the index. We can not17331733+ * wrap-around if passed index == 0.17321734 */17331735pgoff_t page_cache_next_miss(struct address_space *mapping,17341736 pgoff_t index, unsigned long max_scan)···17401738 while (max_scan--) {17411739 void *entry = xas_next(&xas);17421740 if (!entry || xa_is_value(entry))17431743- break;17441744- if (xas.xa_index == 0)17451745- break;17411741+ return xas.xa_index;17421742+ if (xas.xa_index == 0 && index != 0)17431743+ return xas.xa_index;17461744 }1747174517481748- return xas.xa_index;17461746+ /* No gaps in range and no wrap-around, return index beyond range */17471747+ return xas.xa_index + 1;17491748}17501749EXPORT_SYMBOL(page_cache_next_miss);17511750···17671764 *17681765 * Return: The index of the gap if found, otherwise an index outside the17691766 * range specified (in which case 'index - return >= max_scan' will be true).17701770- * In the rare case of wrap-around, ULONG_MAX will be returned.17671767+ * In the rare case of wrap-around, ULONG_MAX will be returned. ULONG_MAX17681768+ * will also be returned if index == ULONG_MAX and there is a gap at the17691769+ * index. We can not wrap-around if passed index == ULONG_MAX.17711770 */17721771pgoff_t page_cache_prev_miss(struct address_space *mapping,17731772 pgoff_t index, unsigned long max_scan)···17791774 while (max_scan--) {17801775 void *entry = xas_prev(&xas);17811776 if (!entry || xa_is_value(entry))17821782- break;17831783- if (xas.xa_index == ULONG_MAX)17841784- break;17771777+ return xas.xa_index;17781778+ if (xas.xa_index == ULONG_MAX && index != ULONG_MAX)17791779+ return xas.xa_index;17851780 }1786178117871787- return xas.xa_index;17821782+ /* No gaps in range and no wrap-around, return index beyond range */17831783+ return xas.xa_index - 1;17881784}17891785EXPORT_SYMBOL(page_cache_prev_miss);17901786
···55#include <linux/seq_file.h>66#include <linux/shrinker.h>77#include <linux/memcontrol.h>88-#include <linux/srcu.h>98109/* defined in vmscan.c */1111-extern struct mutex shrinker_mutex;1010+extern struct rw_semaphore shrinker_rwsem;1211extern struct list_head shrinker_list;1313-extern struct srcu_struct shrinker_srcu;14121513static DEFINE_IDA(shrinker_debugfs_ida);1614static struct dentry *shrinker_debugfs_root;···4951 struct mem_cgroup *memcg;5052 unsigned long total;5153 bool memcg_aware;5252- int ret = 0, nid, srcu_idx;5454+ int ret, nid;53555456 count_per_node = kcalloc(nr_node_ids, sizeof(unsigned long), GFP_KERNEL);5557 if (!count_per_node)5658 return -ENOMEM;57595858- srcu_idx = srcu_read_lock(&shrinker_srcu);6060+ ret = down_read_killable(&shrinker_rwsem);6161+ if (ret) {6262+ kfree(count_per_node);6363+ return ret;6464+ }6565+ rcu_read_lock();59666067 memcg_aware = shrinker->flags & SHRINKER_MEMCG_AWARE;6168···9188 }9289 } while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL);93909494- srcu_read_unlock(&shrinker_srcu, srcu_idx);9191+ rcu_read_unlock();9292+ up_read(&shrinker_rwsem);95939694 kfree(count_per_node);9795 return ret;···115111 .gfp_mask = GFP_KERNEL,116112 };117113 struct mem_cgroup *memcg = NULL;118118- int nid, srcu_idx;114114+ int nid;119115 char kbuf[72];116116+ ssize_t ret;120117121118 read_len = size < (sizeof(kbuf) - 1) ? size : (sizeof(kbuf) - 1);122119 if (copy_from_user(kbuf, buf, read_len))···146141 return -EINVAL;147142 }148143149149- srcu_idx = srcu_read_lock(&shrinker_srcu);144144+ ret = down_read_killable(&shrinker_rwsem);145145+ if (ret) {146146+ mem_cgroup_put(memcg);147147+ return ret;148148+ }150149151150 sc.nid = nid;152151 sc.memcg = memcg;···159150160151 shrinker->scan_objects(shrinker, &sc);161152162162- srcu_read_unlock(&shrinker_srcu, srcu_idx);153153+ up_read(&shrinker_rwsem);163154 mem_cgroup_put(memcg);164155165156 return size;···177168 char buf[128];178169 int id;179170180180- lockdep_assert_held(&shrinker_mutex);171171+ lockdep_assert_held(&shrinker_rwsem);181172182173 /* debugfs isn't initialized yet, add debugfs entries later. */183174 if (!shrinker_debugfs_root)···220211 if (!new)221212 return -ENOMEM;222213223223- mutex_lock(&shrinker_mutex);214214+ down_write(&shrinker_rwsem);224215225216 old = shrinker->name;226217 shrinker->name = new;···238229 shrinker->debugfs_entry = entry;239230 }240231241241- mutex_unlock(&shrinker_mutex);232232+ up_write(&shrinker_rwsem);242233243234 kfree_const(old);244235···251242{252243 struct dentry *entry = shrinker->debugfs_entry;253244254254- lockdep_assert_held(&shrinker_mutex);245245+ lockdep_assert_held(&shrinker_rwsem);255246256247 kfree_const(shrinker->name);257248 shrinker->name = NULL;···280271 shrinker_debugfs_root = dentry;281272282273 /* Create debugfs entries for shrinkers registered at boot */283283- mutex_lock(&shrinker_mutex);274274+ down_write(&shrinker_rwsem);284275 list_for_each_entry(shrinker, &shrinker_list, list)285276 if (!shrinker->debugfs_entry) {286277 ret = shrinker_debugfs_add(shrinker);287278 if (ret)288279 break;289280 }290290- mutex_unlock(&shrinker_mutex);281281+ up_write(&shrinker_rwsem);291282292283 return ret;293284}
+13-4
mm/vmalloc.c
···31483148 * allocation request, free them via vfree() if any.31493149 */31503150 if (area->nr_pages != nr_small_pages) {31513151- /* vm_area_alloc_pages() can also fail due to a fatal signal */31523152- if (!fatal_signal_pending(current))31513151+ /*31523152+ * vm_area_alloc_pages() can fail due to insufficient memory but31533153+ * also:-31543154+ *31553155+ * - a pending fatal signal31563156+ * - insufficient huge page-order pages31573157+ *31583158+ * Since we always retry allocations at order-0 in the huge page31593159+ * case a warning for either is spurious.31603160+ */31613161+ if (!fatal_signal_pending(current) && page_order == 0)31533162 warn_alloc(gfp_mask, NULL,31543154- "vmalloc error: size %lu, page order %u, failed to allocate pages",31553155- area->nr_pages * PAGE_SIZE, page_order);31633163+ "vmalloc error: size %lu, failed to allocate pages",31643164+ area->nr_pages * PAGE_SIZE);31563165 goto fail;31573166 }31583167
+62-76
mm/vmscan.c
···3535#include <linux/cpuset.h>3636#include <linux/compaction.h>3737#include <linux/notifier.h>3838-#include <linux/mutex.h>3838+#include <linux/rwsem.h>3939#include <linux/delay.h>4040#include <linux/kthread.h>4141#include <linux/freezer.h>···5757#include <linux/khugepaged.h>5858#include <linux/rculist_nulls.h>5959#include <linux/random.h>6060-#include <linux/srcu.h>61606261#include <asm/tlbflush.h>6362#include <asm/div64.h>···189190int vm_swappiness = 60;190191191192LIST_HEAD(shrinker_list);192192-DEFINE_MUTEX(shrinker_mutex);193193-DEFINE_SRCU(shrinker_srcu);194194-static atomic_t shrinker_srcu_generation = ATOMIC_INIT(0);193193+DECLARE_RWSEM(shrinker_rwsem);195194196195#ifdef CONFIG_MEMCG197196static int shrinker_nr_max;···208211static struct shrinker_info *shrinker_info_protected(struct mem_cgroup *memcg,209212 int nid)210213{211211- return srcu_dereference_check(memcg->nodeinfo[nid]->shrinker_info,212212- &shrinker_srcu,213213- lockdep_is_held(&shrinker_mutex));214214-}215215-216216-static struct shrinker_info *shrinker_info_srcu(struct mem_cgroup *memcg,217217- int nid)218218-{219219- return srcu_dereference(memcg->nodeinfo[nid]->shrinker_info,220220- &shrinker_srcu);221221-}222222-223223-static void free_shrinker_info_rcu(struct rcu_head *head)224224-{225225- kvfree(container_of(head, struct shrinker_info, rcu));214214+ return rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_info,215215+ lockdep_is_held(&shrinker_rwsem));226216}227217228218static int expand_one_shrinker_info(struct mem_cgroup *memcg,···250266 defer_size - old_defer_size);251267252268 rcu_assign_pointer(pn->shrinker_info, new);253253- call_srcu(&shrinker_srcu, &old->rcu, free_shrinker_info_rcu);269269+ kvfree_rcu(old, rcu);254270 }255271256272 return 0;···276292 int nid, size, ret = 0;277293 int map_size, defer_size = 0;278294279279- mutex_lock(&shrinker_mutex);295295+ down_write(&shrinker_rwsem);280296 map_size = shrinker_map_size(shrinker_nr_max);281297 defer_size = shrinker_defer_size(shrinker_nr_max);282298 size = map_size + defer_size;···292308 info->map_nr_max = shrinker_nr_max;293309 rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_info, info);294310 }295295- mutex_unlock(&shrinker_mutex);311311+ up_write(&shrinker_rwsem);296312297313 return ret;298314}···308324 if (!root_mem_cgroup)309325 goto out;310326311311- lockdep_assert_held(&shrinker_mutex);327327+ lockdep_assert_held(&shrinker_rwsem);312328313329 map_size = shrinker_map_size(new_nr_max);314330 defer_size = shrinker_defer_size(new_nr_max);···336352{337353 if (shrinker_id >= 0 && memcg && !mem_cgroup_is_root(memcg)) {338354 struct shrinker_info *info;339339- int srcu_idx;340355341341- srcu_idx = srcu_read_lock(&shrinker_srcu);342342- info = shrinker_info_srcu(memcg, nid);356356+ rcu_read_lock();357357+ info = rcu_dereference(memcg->nodeinfo[nid]->shrinker_info);343358 if (!WARN_ON_ONCE(shrinker_id >= info->map_nr_max)) {344359 /* Pairs with smp mb in shrink_slab() */345360 smp_mb__before_atomic();346361 set_bit(shrinker_id, info->map);347362 }348348- srcu_read_unlock(&shrinker_srcu, srcu_idx);363363+ rcu_read_unlock();349364 }350365}351366···357374 if (mem_cgroup_disabled())358375 return -ENOSYS;359376360360- mutex_lock(&shrinker_mutex);377377+ down_write(&shrinker_rwsem);378378+ /* This may call shrinker, so it must use down_read_trylock() */361379 id = idr_alloc(&shrinker_idr, shrinker, 0, 0, GFP_KERNEL);362380 if (id < 0)363381 goto unlock;···372388 shrinker->id = id;373389 ret = 0;374390unlock:375375- mutex_unlock(&shrinker_mutex);391391+ up_write(&shrinker_rwsem);376392 return ret;377393}378394···382398383399 BUG_ON(id < 0);384400385385- lockdep_assert_held(&shrinker_mutex);401401+ lockdep_assert_held(&shrinker_rwsem);386402387403 idr_remove(&shrinker_idr, id);388404}···392408{393409 struct shrinker_info *info;394410395395- info = shrinker_info_srcu(memcg, nid);411411+ info = shrinker_info_protected(memcg, nid);396412 return atomic_long_xchg(&info->nr_deferred[shrinker->id], 0);397413}398414···401417{402418 struct shrinker_info *info;403419404404- info = shrinker_info_srcu(memcg, nid);420420+ info = shrinker_info_protected(memcg, nid);405421 return atomic_long_add_return(nr, &info->nr_deferred[shrinker->id]);406422}407423···417433 parent = root_mem_cgroup;418434419435 /* Prevent from concurrent shrinker_info expand */420420- mutex_lock(&shrinker_mutex);436436+ down_read(&shrinker_rwsem);421437 for_each_node(nid) {422438 child_info = shrinker_info_protected(memcg, nid);423439 parent_info = shrinker_info_protected(parent, nid);···426442 atomic_long_add(nr, &parent_info->nr_deferred[i]);427443 }428444 }429429- mutex_unlock(&shrinker_mutex);445445+ up_read(&shrinker_rwsem);430446}431447432448static bool cgroup_reclaim(struct scan_control *sc)···727743 shrinker->name = NULL;728744#endif729745 if (shrinker->flags & SHRINKER_MEMCG_AWARE) {730730- mutex_lock(&shrinker_mutex);746746+ down_write(&shrinker_rwsem);731747 unregister_memcg_shrinker(shrinker);732732- mutex_unlock(&shrinker_mutex);748748+ up_write(&shrinker_rwsem);733749 return;734750 }735751···739755740756void register_shrinker_prepared(struct shrinker *shrinker)741757{742742- mutex_lock(&shrinker_mutex);743743- list_add_tail_rcu(&shrinker->list, &shrinker_list);758758+ down_write(&shrinker_rwsem);759759+ list_add_tail(&shrinker->list, &shrinker_list);744760 shrinker->flags |= SHRINKER_REGISTERED;745761 shrinker_debugfs_add(shrinker);746746- mutex_unlock(&shrinker_mutex);762762+ up_write(&shrinker_rwsem);747763}748764749765static int __register_shrinker(struct shrinker *shrinker)···794810 if (!(shrinker->flags & SHRINKER_REGISTERED))795811 return;796812797797- mutex_lock(&shrinker_mutex);798798- list_del_rcu(&shrinker->list);813813+ down_write(&shrinker_rwsem);814814+ list_del(&shrinker->list);799815 shrinker->flags &= ~SHRINKER_REGISTERED;800816 if (shrinker->flags & SHRINKER_MEMCG_AWARE)801817 unregister_memcg_shrinker(shrinker);802818 debugfs_entry = shrinker_debugfs_detach(shrinker, &debugfs_id);803803- mutex_unlock(&shrinker_mutex);804804-805805- atomic_inc(&shrinker_srcu_generation);806806- synchronize_srcu(&shrinker_srcu);819819+ up_write(&shrinker_rwsem);807820808821 shrinker_debugfs_remove(debugfs_entry, debugfs_id);809822···812831/**813832 * synchronize_shrinkers - Wait for all running shrinkers to complete.814833 *815815- * This is useful to guarantee that all shrinker invocations have seen an816816- * update, before freeing memory.834834+ * This is equivalent to calling unregister_shrink() and register_shrinker(),835835+ * but atomically and with less overhead. This is useful to guarantee that all836836+ * shrinker invocations have seen an update, before freeing memory, similar to837837+ * rcu.817838 */818839void synchronize_shrinkers(void)819840{820820- atomic_inc(&shrinker_srcu_generation);821821- synchronize_srcu(&shrinker_srcu);841841+ down_write(&shrinker_rwsem);842842+ up_write(&shrinker_rwsem);822843}823844EXPORT_SYMBOL(synchronize_shrinkers);824845···929946{930947 struct shrinker_info *info;931948 unsigned long ret, freed = 0;932932- int srcu_idx, generation;933933- int i = 0;949949+ int i;934950935951 if (!mem_cgroup_online(memcg))936952 return 0;937953938938-again:939939- srcu_idx = srcu_read_lock(&shrinker_srcu);940940- info = shrinker_info_srcu(memcg, nid);954954+ if (!down_read_trylock(&shrinker_rwsem))955955+ return 0;956956+957957+ info = shrinker_info_protected(memcg, nid);941958 if (unlikely(!info))942959 goto unlock;943960944944- generation = atomic_read(&shrinker_srcu_generation);945945- for_each_set_bit_from(i, info->map, info->map_nr_max) {961961+ for_each_set_bit(i, info->map, info->map_nr_max) {946962 struct shrink_control sc = {947963 .gfp_mask = gfp_mask,948964 .nid = nid,···9871005 set_shrinker_bit(memcg, nid, i);9881006 }9891007 freed += ret;990990- if (atomic_read(&shrinker_srcu_generation) != generation) {991991- srcu_read_unlock(&shrinker_srcu, srcu_idx);992992- i++;993993- goto again;10081008+10091009+ if (rwsem_is_contended(&shrinker_rwsem)) {10101010+ freed = freed ? : 1;10111011+ break;9941012 }9951013 }9961014unlock:997997- srcu_read_unlock(&shrinker_srcu, srcu_idx);10151015+ up_read(&shrinker_rwsem);9981016 return freed;9991017}10001018#else /* CONFIG_MEMCG */···10311049{10321050 unsigned long ret, freed = 0;10331051 struct shrinker *shrinker;10341034- int srcu_idx, generation;1035105210361053 /*10371054 * The root memcg might be allocated even though memcg is disabled···10421061 if (!mem_cgroup_disabled() && !mem_cgroup_is_root(memcg))10431062 return shrink_slab_memcg(gfp_mask, nid, memcg, priority);1044106310451045- srcu_idx = srcu_read_lock(&shrinker_srcu);10641064+ if (!down_read_trylock(&shrinker_rwsem))10651065+ goto out;1046106610471047- generation = atomic_read(&shrinker_srcu_generation);10481048- list_for_each_entry_srcu(shrinker, &shrinker_list, list,10491049- srcu_read_lock_held(&shrinker_srcu)) {10671067+ list_for_each_entry(shrinker, &shrinker_list, list) {10501068 struct shrink_control sc = {10511069 .gfp_mask = gfp_mask,10521070 .nid = nid,···10561076 if (ret == SHRINK_EMPTY)10571077 ret = 0;10581078 freed += ret;10591059-10601060- if (atomic_read(&shrinker_srcu_generation) != generation) {10791079+ /*10801080+ * Bail out if someone want to register a new shrinker to10811081+ * prevent the registration from being stalled for long periods10821082+ * by parallel ongoing shrinking.10831083+ */10841084+ if (rwsem_is_contended(&shrinker_rwsem)) {10611085 freed = freed ? : 1;10621086 break;10631087 }10641088 }1065108910661066- srcu_read_unlock(&shrinker_srcu, srcu_idx);10901090+ up_read(&shrinker_rwsem);10911091+out:10671092 cond_resched();10681093 return freed;10691094}···47594774{47604775 int seg;47614776 int old, new;47774777+ unsigned long flags;47624778 int bin = get_random_u32_below(MEMCG_NR_BINS);47634779 struct pglist_data *pgdat = lruvec_pgdat(lruvec);4764478047654765- spin_lock(&pgdat->memcg_lru.lock);47814781+ spin_lock_irqsave(&pgdat->memcg_lru.lock, flags);4766478247674783 VM_WARN_ON_ONCE(hlist_nulls_unhashed(&lruvec->lrugen.list));47684784···47984812 if (!pgdat->memcg_lru.nr_memcgs[old] && old == get_memcg_gen(pgdat->memcg_lru.seq))47994813 WRITE_ONCE(pgdat->memcg_lru.seq, pgdat->memcg_lru.seq + 1);4800481448014801- spin_unlock(&pgdat->memcg_lru.lock);48154815+ spin_unlock_irqrestore(&pgdat->memcg_lru.lock, flags);48024816}4803481748044818void lru_gen_online_memcg(struct mem_cgroup *memcg)···48114825 struct pglist_data *pgdat = NODE_DATA(nid);48124826 struct lruvec *lruvec = get_lruvec(memcg, nid);4813482748144814- spin_lock(&pgdat->memcg_lru.lock);48284828+ spin_lock_irq(&pgdat->memcg_lru.lock);4815482948164830 VM_WARN_ON_ONCE(!hlist_nulls_unhashed(&lruvec->lrugen.list));48174831···4822483648234837 lruvec->lrugen.gen = gen;4824483848254825- spin_unlock(&pgdat->memcg_lru.lock);48394839+ spin_unlock_irq(&pgdat->memcg_lru.lock);48264840 }48274841}48284842···48464860 struct pglist_data *pgdat = NODE_DATA(nid);48474861 struct lruvec *lruvec = get_lruvec(memcg, nid);4848486248494849- spin_lock(&pgdat->memcg_lru.lock);48634863+ spin_lock_irq(&pgdat->memcg_lru.lock);4850486448514865 VM_WARN_ON_ONCE(hlist_nulls_unhashed(&lruvec->lrugen.list));48524866···48584872 if (!pgdat->memcg_lru.nr_memcgs[gen] && gen == get_memcg_gen(pgdat->memcg_lru.seq))48594873 WRITE_ONCE(pgdat->memcg_lru.seq, pgdat->memcg_lru.seq + 1);4860487448614861- spin_unlock(&pgdat->memcg_lru.lock);48754875+ spin_unlock_irq(&pgdat->memcg_lru.lock);48624876 }48634877}48644878
+9-2
mm/zswap.c
···12291229 goto reject;12301230 }1231123112321232+ /*12331233+ * XXX: zswap reclaim does not work with cgroups yet. Without a12341234+ * cgroup-aware entry LRU, we will push out entries system-wide based on12351235+ * local cgroup limits.12361236+ */12321237 objcg = get_obj_cgroup_from_page(page);12331233- if (objcg && !obj_cgroup_may_zswap(objcg))12341234- goto shrink;12381238+ if (objcg && !obj_cgroup_may_zswap(objcg)) {12391239+ ret = -ENOMEM;12401240+ goto reject;12411241+ }1235124212361243 /* reclaim space if needed */12371244 if (zswap_is_full()) {