函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swapfile.c Create Date:2022-07-27 16:49:35
Last Modify:2020-03-17 22:19:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:SYSCALL_DEFINE1

函数原型:SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)

返回类型:

参数:

2517  struct swap_info_struct * p = NULL
2525  found等于0
2528  如果非操作权限检查则返回:负EPERM
2531  BUG_ON(!mm)
2533  pathname等于getname(specialfile)
2534  如果是错误则返回:错误
2537  victim等于file_open_name(pathname, O_RDWR | O_LARGEFILE, 0)
2538  err等于错误
2539  如果是错误则转到:out
2542  mapping等于f_mapping
2543  加自旋锁
2544  plist_for_each_entry - iterate over list of given type*@pos: the type * to use as a loop counter*@head: the head for your list*@mem: the name of the list_head within the struct(p, & all active swap_info_structs* protected with swap_lock, and ordered by priority., list)
2545  如果SWP_USED etc: see above 按位与SWP_WRITEOK
2546  如果f_mapping恒等于mapping
2547  found等于1
2548  退出
2552  如果非found
2553  err等于负EINVAL
2554  自旋锁解锁
2555  转到:out_dput
2557  如果非security_vm_enough_memory_mm(mm, al of usable pages of swap )则vm_unacct_memory(al of usable pages of swap )
2559  否则
2560  err等于负ENOMEM
2561  自旋锁解锁
2562  转到:out_dput
2564  del_from_avail_list(p)
2565  加自旋锁
2566  如果swap priority of this type 小于0则
2567  si等于p
2572  prio自减
2573  for_each_node(nid)
2574  如果prio不等于1则prio自减
2578  least_priority自加
2580  从plist移除节点
2581  atomic_long_sub(al of usable pages of swap , & nr_swap_pages)
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的反
2584  自旋锁解锁
2585  自旋锁解锁
2587  disable_swap_slots_cache_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  如果err
2595  reinsert_swap_info(p)
2596  reenable_swap_slots_cache_unlock()
2597  转到:out_dput
2600  reenable_swap_slots_cache_unlock()
2602  加自旋锁
2603  加自旋锁
2604  SWP_USED etc: see above 与等于SWP_VALID的反
2605  自旋锁解锁
2606  自旋锁解锁
2611  Wait for a grace period to elapse. But it is illegal to invoke* synchronize_rcu() from within an RCU read-side critical section.* Therefore, any legal call to synchronize_rcu() is a quiescent
2613  lush_work - wait for a work to finish executing the last queueing instance*@work: the work to flush* Wait until @work has finished execution
2615  Free all of a swapdev's extent information
2616  如果SWP_USED etc: see above 按位与SWP_CONTINUED_swap_count_continuations - swapoff free all the continuation pages* appended to the swap_map, after swap_map is quiesced, before vfree'ing it.
2619  如果非swap device or bdev of swap file 或非blk_queue_nonrot(bdev_get_queue(swap device or bdev of swap file ))则atomic_dec( & nr_rotate_swap)
2622  mutex_lock( & swapon_mutex)
2623  加自旋锁
2624  加自旋锁
2625  After a successful try_to_unuse, if no swap is now in use, we know* we can empty the mmlist. swap_lock must be held on entry and exit.* Note that mmlist_lock nests inside swap_lock, and an mm must be
2628  dex of last free in swap_map 等于0
2629 SWP_USED etc: see above 大于等于SWP_SCANNING循环
2630  自旋锁解锁
2631  自旋锁解锁
2632  schedule_timeout_uninterruptible(1)
2633  加自旋锁
2634  加自旋锁
2637  swap_file等于seldom referenced
2638  old_block_size等于seldom referenced
2639  seldom referenced = NULL
2640  xtent of the swap_map 等于0
2641  swap_map等于vmalloc'ed array of usage counts
2642  vmalloc'ed array of usage counts = NULL
2643  cluster_info等于cluster info. Only for SSD
2644  cluster info. Only for SSD = NULL
2645  frontswap_map等于frontswap_map_get(p)
2646  自旋锁解锁
2647  自旋锁解锁
2648  frontswap_invalidate_area(strange name for an index )
2649  frontswap_map_set(p, NULL)
2650  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
2651  释放内存
2652  per cpu's swap location = NULL
2653  vfree - release memory allocated by vmalloc()*@addr: memory base address* Free the virtually continuous memory area starting at @addr, as* obtained from vmalloc(), vmalloc_32() or __vmalloc()
2654  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
2655  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
2657  swap_cgroup_swapoff(strange name for an index )
2658  exit_swap_address_space(strange name for an index )
2660  inode等于host
2661  如果S_ISBLK(i_mode)则
2662  bdev等于I_BDEV(inode)
2664  set_blocksize(bdev, old_block_size)
2665  blkdev_put(bdev, le is open for reading | le is open for writing | File is opened with O_EXCL (only set for block devices) )
2668  inode_lock(inode)
2669  i_flags与等于Do not truncate: swapon got its bmaps 的反
2670  inode_unlock(inode)
2671  filp_close(swap_file, NULL)
2678  加自旋锁
2679  SWP_USED etc: see above 等于0
2680  自旋锁解锁
2682  err等于0
2683  atomic_inc( & Activity counter to indicate that a swapon or swapoff has occurred )
2684  wake_up_interruptible( & proc_poll_wait)
2686  out_dput :
2687  filp_close(victim, NULL)
2688  out :
2689  putname(pathname)
2690  返回:err