Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp189462imj; Thu, 14 Feb 2019 18:18:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IZlaeigaEPR9EIVJBtgaKHoyV0gyDTALZrwhqbyyPUb58RIAGKA+BE83ll2LxJYguQbCW+V X-Received: by 2002:a17:902:780a:: with SMTP id p10mr7785670pll.54.1550197083824; Thu, 14 Feb 2019 18:18:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550197083; cv=none; d=google.com; s=arc-20160816; b=A4nVtNGnG+NQkzYhzYh1kHUAH5IrtjFZQYVZ9fnfKYl7pIF+TnMBQaAqid48mD+ciP w2nwbkYz5yuxl3O4Ewjk2TM6VrEwvu06WVhiJL/ILIL2fBYH93sbgxmoQEs3PlofFHUk pXNhyHaDKKvBf/gDVN6EmPhIrm+4K+do02RODkajDfMLxGAQzaV33qiAQQZqRIgJUEa4 cAzoorg07nHDcTKb1V1gdDu1xNA0YUhQK3U8MNJ/1fgpA1+kacbhggQWjMMi8QSjPwQN FjE37+at4/tWJzpPLSrVh3duaOZm4LQ0s/cBhgows6yQnFUQqc7MmeLXsiWDxZRxMf2S kuAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=o37Y+f/1VXVMWondogstLZO0MYD+7tXS7P2EG+VyVC8=; b=vKsN8tdX/DzlIUm7ldS7bETaLlCZ6PSQ+R5saxHgi8Li7kd0vPGtmePCtkmQyNe2bx ekMGUQhhYdln5MWTbu3G1I/DvvhZDmTg6VOmYb4YCiFYiURIruZJBOmyc4htHKIJaxl+ spcnJuQq8fKRsduGwrR2I4ne5QniDFpGDg0iiUgxhKT7kaeJcp+Qjv/DlZaxMurFXl1s CwIFvnFMlIvTp3JwkneOqHSv8YcEKvrUYeFmMPzRHBR/rhHwuQDFR6rlcQz51odfRfUA lYu/CK737yoRlCyuiJszBs/BFBt1+1APgSrETSfNSs+Hoz5/647oXmeLwu8FI44Eb7tR h95w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si4065014pgh.147.2019.02.14.18.17.48; Thu, 14 Feb 2019 18:18:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406947AbfBNVrr (ORCPT + 99 others); Thu, 14 Feb 2019 16:47:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36740 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406222AbfBNVrq (ORCPT ); Thu, 14 Feb 2019 16:47:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92CBDC058CAD; Thu, 14 Feb 2019 21:47:46 +0000 (UTC) Received: from sky.random (ovpn-120-178.rdu2.redhat.com [10.10.120.178]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A208E600C1; Thu, 14 Feb 2019 21:47:42 +0000 (UTC) Date: Thu, 14 Feb 2019 16:47:41 -0500 From: Andrea Arcangeli To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , "Paul E . McKenney" , Minchan Kim , Johannes Weiner , Tim Chen , Mel Gorman , =?iso-8859-1?B?Su+/vXLvv71tZQ==?= Glisse , Michal Hocko , David Rientjes , Rik van Riel , Jan Kara , Dave Jiang , Daniel Jordan , Andrea Parri Subject: Re: [PATCH -mm -V7] mm, swap: fix race between swapoff and some swap operations Message-ID: <20190214214741.GB10698@redhat.com> References: <20190211083846.18888-1-ying.huang@intel.com> <20190214023805.GA19090@redhat.com> <87k1i2oks6.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k1i2oks6.fsf@yhuang-dev.intel.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 14 Feb 2019 21:47:46 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 14, 2019 at 04:07:37PM +0800, Huang, Ying wrote: > Before, we choose to use stop_machine() to reduce the overhead of hot > path (page fault handler) as much as possible. But now, I found > rcu_read_lock_sched() is just a wrapper of preempt_disable(). So maybe > we can switch to RCU version now. rcu_read_lock looks more efficient than rcu_read_lock_sched. So for this purpose in the fast path rcu_read_lock()/unlock() should be the preferred methods, no need to force preempt_disable() (except for debug purposes if sleep debug is enabled). Server builds are done with voluntary preempt (no preempt shouldn't even exist as config option) and there rcu_read_lock might be just a noop. Against a fast path rcu_read_lock/unlock before the consolidation synchronize_rcu would have been enough, now after the consolidation even more certain that it's enough because it's equivalent to _mult.