This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Wed Jan 27 22:04:40 2021 >From mailfetcher Fri Jul 26 10:44:52 2019 Envelope-to: lkml@grols.ch Delivery-date: Fri, 26 Jul 2019 10:44:31 +0200 Received: from stout.grols.ch [195.201.141.146] by 72459556e3a9 with IMAP (fetchmail-6.3.26) for (single-drop); Fri, 26 Jul 2019 10:44:52 +0200 (CEST) Received: from vger.kernel.org ([209.132.180.67]) by stout.grols.ch with esmtp (Exim 4.89) (envelope-from ) id 1hqvq3-0004fK-DZ for lkml@grols.ch; Fri, 26 Jul 2019 10:44:31 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725842AbfGZIo1 convert rfc822-to-8bit (ORCPT ); Fri, 26 Jul 2019 04:44:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41238 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbfGZIo1 (ORCPT ); Fri, 26 Jul 2019 04:44:27 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9136830A6960; Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.136]) by smtp.corp.redhat.com (Postfix) with SMTP id 856EC101E241; Fri, 26 Jul 2019 08:44:24 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 26 Jul 2019 10:44:26 +0200 (CEST) Date: Fri, 26 Jul 2019 10:44:23 +0200 From: Oleg Nesterov To: Song Liu Cc: lkml , Linux-MM , Andrew Morton , "matthew.wilcox@oracle.com" , "kirill.shutemov@linux.intel.com" References: <20190724083600.832091-1-songliubraving@fb.com> <20190724083600.832091-3-songliubraving@fb.com> <20190724113711.GE21599@redhat.com> <20190725081414.GB4707@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 26 Jul 2019 08:44:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-Id: X-Mailing-List: linux-kernel@vger.kernel.org Received-SPF: none client-ip=209.132.180.67; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org X-Spam-Score: -1.9 X-Spam-Score-Bar: - X-Spam-Action: no action X-Spam-Report: Action: no action Symbol: ARC_NA(0.00) Symbol: TO_DN_EQ_ADDR_SOME(0.00) Symbol: DMARC_POLICY_SOFTFAIL(0.10) Symbol: BAYES_HAM(-2.32) Symbol: FROM_HAS_DN(0.00) Symbol: TO_DN_SOME(0.00) Symbol: PRECEDENCE_BULK(0.00) Symbol: MIME_GOOD(-0.10) Symbol: MIME_TR On 07/25, Song Liu wrote: > > I guess I know the case now. We can probably avoid this with an simple > check for old_page == new_page? better yet, I think we can check PageAnon(old_page) and avoid the unnecessary __replace_page() in this case. See the patch below. Anyway, why __replace_page() needs to lock both pages? This doesn't look nice even if it were correct. I think it can do lock_page(old_page) later. Oleg. --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -488,6 +488,10 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, ref_ctr_updated = 1; } + ret = 0; + if (!is_register && !PageAnon(old_page)) + goto put_old; + ret = anon_vma_prepare(vma); if (ret) goto put_old;