Re: [PATCH 1/3] mm/sparse: add likely to mem_section[root] check in sparse_index_init()
From: Wei Yang <hidden>
Date: 2018-09-11 15:00:52
On Mon, Sep 10, 2018 at 01:30:11PM -0700, Dave Hansen wrote:
On 09/08/2018 06:38 PM, owner-linux-mm@kvack.org wrote:quoted
At last, here is the test result on my 4G virtual machine. I added printk before and after sparse_memory_present_with_active_regions() and tested three times with/without "likely". without with Elapsed 0.000252 0.000250 -0.8% The benefit seems to be too small on a 4G virtual machine or even this is not stable. Not sure we can see some visible effect on a 32G machine.I think it's highly unlikely you have found something significant here. It's one system, in a VM and it's not being measured using a mechanism that is suitable for benchmarking (the kernel dmesg timestamps). Plus, if this is a really tight loop, the cpu's branch predictors will be good at it.
Hi, Dave Thanks for your reply. I think you are right. This part is not significant and cpu may do its job well. Hmm... I am still willing to hear your opinion on my analysis of this situation. In which case we would use likely/unlikely. For example, in this case the possibility is (255/ 256) if the system has 32G RAM. Do we have a threshold of the possibility to use likely/unlikely. Or we'd prefer not to use this any more? Let compiler and cpu do their job. Look forward your insights. -- Wei Yang Help you, Help me