Fri, Mar 11, 2011 at 11:44 AM, Hugh Dickins <hughd@xxxxxxxxxx> wrote: > On Thu, Mar 10, 2011 at 6:04 PM, Andrea Arcangeli <aarcange@xxxxxxxxxx> wrote: >> >> I've been wondering why mremap is sending one IPI for each page that >> it moves. I tried to remove that so we send an IPI for each >> vma/syscall (not for each pte/page). > > (It wouldn't usually have been sending an IPI for each page, only if > the mm were active on another cpu, but...) > > That looks like a good optimization to me: I can't think of a good > reason for it to be the way it was, just it started out like that and > none of us ever thought to change it before. ÂPlus it's always nice to > see the flush_tlb_range() afterwards complementing the > flush_cache_range() beforehand, as you now have in move_page_tables(). > > And don't forget that move_page_tables() is also used by exec's > shift_arg_pages(): no IPI saving there, but it should be more > efficient when exec'ing with many arguments. Perhaps I should qualify that answer: although I still think it's the right change to make (it matches mprotect, for example), and an optimization in many cases, it will be a pessimization for anyone who mremap moves unpopulated areas (I doubt that's common), and for anyone who moves around single page areas (on x86 and probably some others). But the exec args case has, I think, few useful tlb entries to lose from the mm-wide tlb flush. flush_tlb_range() ought to special case small areas, doing at most one IPI, but up to some number of flush_tlb_one()s; but that would certainly have to be another patch. Hugh -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href