Function report |
Source Code:mm\swapfile.c |
Create Date:2022-07-28 15:19:09 |
Last Modify:2020-03-17 22:19:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:SYSCALL_DEFINE1
Proto:SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
Type:
Parameter:Nothing
2517 | struct swap_info_struct * p = NULL |
2525 | found = 0 |
2528 | If Not Check operation authority Then Return -EPERM |
2533 | pathname = getname(specialfile) |
2537 | victim = file_open_name(pathname, O_RDWR | O_LARGEFILE, 0) |
2545 | If SWP_USED etc: see above & SWP_WRITEOK Then |
2552 | If Not found Then |
2557 | If Not security_vm_enough_memory_mm(mm, al of usable pages of swap ) Then vm_unacct_memory(al of usable pages of swap ) |
2559 | Else |
2564 | del_from_avail_list(p) |
2566 | If swap priority of this type < 0 Then |
2578 | least_priority++ |
2582 | protected with swap_lock. reading in vm_swap_full() doesn't need lock -= al of usable pages of swap |
2583 | SWP_USED etc: see above &= ~SWP_WRITEOK |
2585 | spin_unlock( & swap_lock) |
2589 | set_current_oom_origin() |
2590 | err = If the boolean frontswap is true, only unuse pages_to_unuse pages;* pages_to_unuse==0 means all pages; ignored if frontswap is false |
2591 | clear_current_oom_origin() |
2593 | If err Then |
2604 | SWP_USED etc: see above &= ~SWP_VALID |
2606 | spin_unlock( & swap_lock) |
2616 | If SWP_USED etc: see above & SWP_CONTINUED Then _swap_count_continuations - swapoff free all the continuation pages* appended to the swap_map, after swap_map is quiesced, before vfree'ing it. |
2619 | If Not swap device or bdev of swap file || Not blk_queue_nonrot(bdev_get_queue(swap device or bdev of swap file )) Then atomic_dec( & nr_rotate_swap) |
2622 | mutex_lock( & swapon_mutex) |
2628 | dex of last free in swap_map = 0 |
2629 | When SWP_USED etc: see above >= SWP_SCANNING cycle |
2631 | spin_unlock( & swap_lock) |
2632 | schedule_timeout_uninterruptible(1) |
2637 | swap_file = seldom referenced |
2638 | old_block_size = seldom referenced |
2639 | seldom referenced = NULL |
2640 | xtent of the swap_map = 0 |
2642 | vmalloc'ed array of usage counts = NULL |
2644 | cluster info. Only for SSD = NULL |
2645 | frontswap_map = frontswap_map_get(p) |
2647 | spin_unlock( & swap_lock) |
2649 | frontswap_map_set(p, NULL) |
2652 | per cpu's swap location = NULL |
2664 | set_blocksize(bdev, old_block_size) |
2668 | inode_lock(inode) |
2670 | inode_unlock(inode) |
2671 | filp_close(swap_file, NULL) |
2679 | SWP_USED etc: see above = 0 |
2680 | spin_unlock( & swap_lock) |
2682 | err = 0 |
2684 | wake_up_interruptible( & proc_poll_wait) |
2686 | out_dput : |
2687 | filp_close(victim, NULL) |
2688 | out : |
2690 | Return err |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |