________________________________________ From: Pankaj Suryawanshi Sent: 03 April 2019 19:50 To: linux-mm@xxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx Subject: How to calculate instruction executed for function Hello, How to calculate instruction executed for function ? For eg. I need to calculate instruction executed for CMA_ALLOC function. How many instruction executed for cma_alloc ? CMA_ALLOC : for 1 cma_alloc success call there will around 75 instruction is executed, excluding jump, mutex,error case and debug info instruction. below are mandatory jump calls that are required for successful allocations. cma_bitmap_aligned_mask cma_bitmap_aligned_offset cma_bitmap_maxno cma_bitmap_pages_to_bits bitmap_find_next_zero_area_off -> find_next_zero_bit -> find_next_bit bitmap_set alloc_contig_range -> start_isolate_page_range __alloc_contig_migrate_range -> isolate_migratepages_range -> reclaim_clean_pages_from_list -> shrink_page_list -> migrate_pages So lets say cma_bitmap_aligned_mask = 1 instrs cma_bitmap_aligned_offset = 1 instrs cma_bitmap_maxno = 1 instrs cma_bitmap_pages_to_bits = 1 instrs bitmap_find_next_zero_area_off -> find_next_zero_bit -> find_next_bit = 3 instrs bitmap_set = 1 instrs alloc_contig_range -> start_isolate_page_range = has_unmovable_pages = 1 instrs get_pfnblock_flags_mask = 1 instrs set_pageblock_migratetype = 1 instrs move_freepages_block = 1 instrn __mod_zone_page_state = 1 instrs store info in vmstat unset_migratetype_isolate = 1 instrs __alloc_contig_migrate_range -> isolate_migratepages_range -> reclaim_clean_pages_from_list -> shrink_page_list -> migrate_pages isolate_migratepages_range = 3 instrs reclaim_clean_pages_from_list = 2 instrs migrate_pages = 1 instrs -------------------------------------------------------------- Total = around 20 instrs per page 20 ns per page on 1ghz processor is minimum excluding any overheads like mutex, variables, failure/error case,debug/prints. I roughly calculated this. Is it Correct ? Any help would be appreciated. Regards, Pankaj ************************************************************************************************************************************************************* eInfochips Business Disclaimer: This e-mail message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally privileged and confidential information. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to this message and please delete it from your computer. Any views expressed in this message are those of the individual sender unless otherwise stated. Company has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email. *************************************************************************************************************************************************************