From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH v4 2/2] powerpc/mm: Tracking vDSO remap Date: Thu, 26 Mar 2015 19:55:50 +0100 Message-ID: <20150326185550.GA25547@gmail.com> References: <20150326141730.GA23060@gmail.com> <7fdae652993cf88bdd633d65e5a8f81c7ad8a1e3.1427390952.git.ldufour@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <7fdae652993cf88bdd633d65e5a8f81c7ad8a1e3.1427390952.git.ldufour@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org To: Laurent Dufour Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Jeff Dike , Richard Weinberger , Guan Xuetao , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Arnd Bergmann , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net, user-mode-linux-user@lists.sourceforge.net, linux-arch@vger.kernel.org, linux-mm@kvack.org, cov@codeaurora.org, criu@openvz.org List-Id: linux-arch.vger.kernel.org * Laurent Dufour wrote: > +{ > + unsigned long vdso_end, vdso_start; > + > + if (!mm->context.vdso_base) > + return; > + vdso_start = mm->context.vdso_base; > + > +#ifdef CONFIG_PPC64 > + /* Calling is_32bit_task() implies that we are dealing with the > + * current process memory. If there is a call path where mm is not > + * owned by the current task, then we'll have need to store the > + * vDSO size in the mm->context. > + */ > + BUG_ON(current->mm != mm); > + if (is_32bit_task()) > + vdso_end = vdso_start + (vdso32_pages << PAGE_SHIFT); > + else > + vdso_end = vdso_start + (vdso64_pages << PAGE_SHIFT); > +#else > + vdso_end = vdso_start + (vdso32_pages << PAGE_SHIFT); > +#endif > + vdso_end += (1< + > + /* Check if the vDSO is in the range of the remapped area */ > + if ((vdso_start <= old_start && old_start < vdso_end) || > + (vdso_start < old_end && old_end <= vdso_end) || > + (old_start <= vdso_start && vdso_start < old_end)) { > + /* Update vdso_base if the vDSO is entirely moved. */ > + if (old_start == vdso_start && old_end == vdso_end && > + (old_end - old_start) == (new_end - new_start)) > + mm->context.vdso_base = new_start; > + else > + mm->context.vdso_base = 0; > + } > +} Oh my, that really looks awfully complex, as you predicted, and right in every mremap() call. I'm fine with your original, imperfect, KISS approach. Sorry about this detour ... Reviewed-by: Ingo Molnar Thanks, Ingo -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f52.google.com ([74.125.82.52]:33914 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752936AbbCZSz4 (ORCPT ); Thu, 26 Mar 2015 14:55:56 -0400 Date: Thu, 26 Mar 2015 19:55:50 +0100 From: Ingo Molnar Subject: Re: [PATCH v4 2/2] powerpc/mm: Tracking vDSO remap Message-ID: <20150326185550.GA25547@gmail.com> References: <20150326141730.GA23060@gmail.com> <7fdae652993cf88bdd633d65e5a8f81c7ad8a1e3.1427390952.git.ldufour@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7fdae652993cf88bdd633d65e5a8f81c7ad8a1e3.1427390952.git.ldufour@linux.vnet.ibm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Laurent Dufour Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Jeff Dike , Richard Weinberger , Guan Xuetao , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Arnd Bergmann , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net, user-mode-linux-user@lists.sourceforge.net, linux-arch@vger.kernel.org, linux-mm@kvack.org, cov@codeaurora.org, criu@openvz.org Message-ID: <20150326185550.KOrutOh_uY-6WNfkzdJPnfC7ujwxuZRWZRb539bXZ04@z> * Laurent Dufour wrote: > +{ > + unsigned long vdso_end, vdso_start; > + > + if (!mm->context.vdso_base) > + return; > + vdso_start = mm->context.vdso_base; > + > +#ifdef CONFIG_PPC64 > + /* Calling is_32bit_task() implies that we are dealing with the > + * current process memory. If there is a call path where mm is not > + * owned by the current task, then we'll have need to store the > + * vDSO size in the mm->context. > + */ > + BUG_ON(current->mm != mm); > + if (is_32bit_task()) > + vdso_end = vdso_start + (vdso32_pages << PAGE_SHIFT); > + else > + vdso_end = vdso_start + (vdso64_pages << PAGE_SHIFT); > +#else > + vdso_end = vdso_start + (vdso32_pages << PAGE_SHIFT); > +#endif > + vdso_end += (1< + > + /* Check if the vDSO is in the range of the remapped area */ > + if ((vdso_start <= old_start && old_start < vdso_end) || > + (vdso_start < old_end && old_end <= vdso_end) || > + (old_start <= vdso_start && vdso_start < old_end)) { > + /* Update vdso_base if the vDSO is entirely moved. */ > + if (old_start == vdso_start && old_end == vdso_end && > + (old_end - old_start) == (new_end - new_start)) > + mm->context.vdso_base = new_start; > + else > + mm->context.vdso_base = 0; > + } > +} Oh my, that really looks awfully complex, as you predicted, and right in every mremap() call. I'm fine with your original, imperfect, KISS approach. Sorry about this detour ... Reviewed-by: Ingo Molnar Thanks, Ingo