Function report |
Source Code:mm\swapfile.c |
Create Date:2022-07-28 15:17:05 |
Last Modify:2020-03-17 22:19:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:scan_swap_map_slots
Proto:static int scan_swap_map_slots(struct swap_info_struct *si, unsigned char usage, int nr, swp_entry_t slots[])
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct swap_info_struct * | si | |
unsigned char | usage | |
int | nr | |
swp_entry_t | slots |
739 | last_in_cluster = 0 |
740 | latency_ration = LATENCY_LIMIT |
741 | n_ret = 0 |
743 | If nr > SWAP_BATCH Then nr = SWAP_BATCH |
761 | If cluster info. Only for SSD Then |
762 | If Try to get a swap entry from current cpu's swap entry pool (a cluster). This* might involve allocating a new cluster for current CPU too. Then Go to checks |
764 | Else Go to scan |
771 | Go to checks |
783 | last_in_cluster = offset + SWAPFILE_CLUSTER - 1 |
786 | When last_in_cluster <= dex of last free in swap_map cycle |
787 | If vmalloc'ed array of usage counts [offset] Then last_in_cluster = offset + SWAPFILE_CLUSTER |
789 | Else if offset == last_in_cluster Then |
791 | offset -= SWAPFILE_CLUSTER - 1 |
794 | Go to checks |
796 | If Value for the false possibility is greater at compile time(--latency_ration < 0) Then |
797 | cond_resched() |
798 | latency_ration = LATENCY_LIMIT |
807 | checks : |
808 | If cluster info. Only for SSD Then |
818 | If Not (SWP_USED etc: see above & SWP_WRITEOK) Then Go to no_page |
820 | If Not dex of last free in swap_map Then Go to no_page |
822 | If offset > dex of last free in swap_map Then scan_base = offset = dex of first free in swap_map |
825 | ci = lock_cluster(si, offset) |
827 | If vm_swap_full() && vmalloc'ed array of usage counts [offset] == Flag page is cached, in first swap_map Then |
829 | unlock_cluster(ci) |
834 | If swap_was_freed Then Go to checks |
836 | Go to scan |
839 | If vmalloc'ed array of usage counts [offset] Then |
848 | unlock_cluster(ci) |
850 | swap_range_alloc(si, offset, 1) |
851 | likely index for next allocation = offset + 1 |
855 | If n_ret == nr || offset >= dex of last free in swap_map Then Go to done |
861 | If Value for the false possibility is greater at compile time(--latency_ration < 0) Then |
865 | cond_resched() |
867 | latency_ration = LATENCY_LIMIT |
871 | If cluster info. Only for SSD Then |
872 | If Try to get a swap entry from current cpu's swap entry pool (a cluster). This* might involve allocating a new cluster for current CPU too. Then Go to checks |
874 | Else Go to done |
878 | ++offset |
881 | If countdown to next cluster search && Not vmalloc'ed array of usage counts [offset] Then |
883 | Go to checks |
886 | done : |
888 | Return n_ret |
890 | scan : |
892 | When ++offset <= dex of last free in swap_map cycle |
893 | If Not vmalloc'ed array of usage counts [offset] Then |
895 | Go to checks |
897 | If vm_swap_full() && vmalloc'ed array of usage counts [offset] == Flag page is cached, in first swap_map Then |
899 | Go to checks |
901 | If Value for the false possibility is greater at compile time(--latency_ration < 0) Then |
902 | cond_resched() |
903 | latency_ration = LATENCY_LIMIT |
908 | If Not vmalloc'ed array of usage counts [offset] Then |
910 | Go to checks |
912 | If vm_swap_full() && vmalloc'ed array of usage counts [offset] == Flag page is cached, in first swap_map Then |
914 | Go to checks |
916 | If Value for the false possibility is greater at compile time(--latency_ration < 0) Then |
917 | cond_resched() |
918 | latency_ration = LATENCY_LIMIT |
920 | offset++ |
924 | no_page : |
926 | Return n_ret |
Name | Describe |
---|---|
scan_swap_map | |
get_swap_pages |
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 |