bsp
    @cade:1,相同的work是可以提交多次的,确实有pool->worklist来管理待处理(pending)的work,从log也可以看到: echo t >/proc/sysrq-trigger; dmesg [ 367.575510] Showing busy workqueues and worker pools: [ 367.575513] workqueue events: flags=0x0 [ 367.575520] pwq 4: cpus=0 node=0 flags=0x0 nice=0 active=10/256 [ 367.575530] in-flight: 9297 :mxt_work [ 367.576205] pending: mxt_work, vmstat_shepherd, tsens_poll, tsens_poll, sdhci_msm_pm_qos_cpu_unvote_work, sdhci_msm_pm_qos_cpu_unvote_work, sdhci_msm_pm_qos_irq_unvote_work 这里有两个tsens_poll,两个sdhci_msm_pm_qos_cpu_unvote_work。 至于丢包,那可能是pending太久上层认为timeout丢掉了。 2,关于max_active,Documentation//core-api/workqueue.rst有很好的解释和例子。对于你这例子,传入默认的0最合适,系统会设为256(512/2)。 The following example execution scenarios try to illustrate how cmwq behave under different configurations. Work items w0, w1, w2 are queued to a bound wq q0 on the same CPU. w0 burns CPU for 5ms then sleeps for 10ms then burns CPU for 5ms again before finishing. w1 and w2 burn CPU for 5ms then sleep for 10ms. Ignoring all other tasks, works and processing overhead, and assuming simple FIFO scheduling, the following is one highly simplified version of possible sequences of events with the original wq. :: TIME IN MSECS EVENT 0 w0 starts and burns CPU 5 w0 sleeps 15 w0 wakes up and burns CPU 20 w0 finishes 20 w1 starts and burns CPU 25 w1 sleeps 35 w1 wakes up and finishes 35 w2 starts and burns CPU 40 w2 sleeps 50 w2 wakes up and finishes And with cmwq with ``@max_active`` >= 3, :: TIME IN MSECS EVENT 0 w0 starts and burns CPU 5 w0 sleeps 5 w1 starts and burns CPU 10 w1 sleeps 10 w2 starts and burns CPU 15 w2 sleeps 15 w0 wakes up and burns CPU 20 w0 finishes 20 w1 wakes up and finishes 25 w2 wakes up and finishes If ``@max_active`` == 2, :: ......
    bsp
    @bsp:如果为了模拟PAN是需要切换ttbr1的,看来PAN对进程切换的latency影响不小啊。
    进程切换分析(1):基本框架  发表时间:2021-01-04 17:04
    bsp
    @linuxer:ttbr1_el1 Is the page table base register in kernel space , Use when accessing kernel space address , All processes share , No need to switch. kernel threads之间的切换是不需要切换ttrb1_el1的
    进程切换分析(1):基本框架  发表时间:2021-01-04 16:48
    bsp
    @bsp:也可以得出,在这样的例子中:用户线程A->kernel线程B->kernel线程C/D/E/F->用户线程G,只有最后一个用户线程在执行finish_task_switch时才会mmdrop(A->active_mm)并跟新mm,其它内核线程都是在沿用第一个用户线程的active_mm。由此看来,内核线程的切换loading还是比较轻的。
    进程切换分析(1):基本框架  发表时间:2021-01-04 16:47
    bsp
    @walentine:"这里最后完成switch_to后面BBB部分 的还是B线程",这句话没有问题。 但是在 "用户线程A->kernel线程B->用户线程C" 这样的例子中,B会mmgrab(A->active_mm),因为B没有用户地址空间 不需要更新mm,所以B在执行finish_task_switch时并不会mmdrop(A->active_mm); B切换到C后,如果C是内核线程处理非常简单(C->active_mm = B->active_mm,即A->active_mm),但是如果是用户线程,C在执行finish_task_switch时就会mmdrop(A->active_mm)(说明A没有其它task借用了可以自己玩耍),然后更新C的mm到ttbr0_el1.
    进程切换分析(1):基本框架  发表时间:2021-01-04 16:30
    bsp
    @navadoo:arm/arm64等将内核空间和用户空间 通过不同页表基地址 隔离开来的架构,由于内核是所有task共享的,其实在切换内核线程时 是不需要要切换内核空间的页表基地址(ttbr1_el1),所以enter_lazy_tlb可以是空函数。 但如果在arm中enable了SW_TTBR0_PAN(privilege access non,禁止kernel访问用户空间,如需访问使用copy_from/to_user来先disable PAN,访问后再enable),update_saved_ttbr0其实就是将用户空间基地址ttrb0_el1设成zero page(在访问user address时都是得到0)。 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { /* * We don't actually care about the ttbr0 mapping, so point it at the * zero page. */ update_saved_ttbr0(tsk, &init_mm); }
    进程切换分析(1):基本框架  发表时间:2021-01-04 14:09
    bsp
    @www:我觉得前半部分理解没有问题,从日志也可以看到: echo t >/proc/sysrq-trigger; dmesg [ 367.575510] Showing busy workqueues and worker pools: [ 367.575513] workqueue events: flags=0x0 [ 367.575520] pwq 4: cpus=0 node=0 flags=0x0 nice=0 active=10/256 [ 367.575530] in-flight: 9297 :mxt_work [ 367.576205] pending: mxt_work, watchdog_work, *** 这些work都是挂在到同一个pool中的。 但并行处理是会的,有时候worker_pool太忙了,就会创建新的work-thread去并行处理多个work,这在Concurrency Managed Workqueue之(三/二)有介绍。
    just
    怎么注册账号呢?
    关于蜗窝  发表时间:2020-12-31 12:03
    walentine
    @fanzhang:我也认为有这个问题:A->B后,A先执行switch_to之前的AAA部分代码,切换到B后,自然是B来执行swtich_to后的BBB部分代码,为何B欢快执行后,再走调度切换流程B->C后,要用C来释放借用的A的mm_struct?B和C都是同样的被调度方,B为何不执行finish_task_switch来释放A的mm_struct?
    进程切换分析(1):基本框架  发表时间:2020-12-29 16:16
    xiaowu
    您好,有个疑惑的地方,这个汇编翻译成C的,id_map段创建block_map时,大小小于2M,start和end地址相同,走不进while循环,那岂不是无法填充tbl中的单元? #define create_block_map(tbl, flags, phys, start, end) do { \ phys >>= SWAPPER_BLOCK_SHIFT; /* 1 */ \ start >>= SWAPPER_BLOCK_SHIFT; /* 2 */ \ start &= PTRS_PER_PTE - 1; /* 2 */ \ phys = flags | (phys << SWAPPER_BLOCK_SHIFT);/* 3 */ \ end >>= SWAPPER_BLOCK_SHIFT; /* 4 */ \ end &= PTRS_PER_PTE - 1; /* 4 */ \ \ while (start != end) { /* 5 */ \ *((long *)(tbl + (start << 3))) = phys; /* 6 */ \ start++; /* 7 */ \ phys += SWAPPER_BLOCK_SIZE; /* 8 */ \ } \ } while (0)
    ARM64 Kernel Image Mapping的变化  发表时间:2020-12-27 16:38

共7862条54/787上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 5455 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 下一页
Copyright @ 2013-2015 蜗窝科技 All rights reserved. Powered by emlog