Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp835230imj; Fri, 15 Feb 2019 07:35:38 -0800 (PST) X-Google-Smtp-Source: AHgI3IYBO04zucVmHlHbowRSf/LMyWJ7vcaZa+s9XjrGJ3rRod1SdVBEh8HBfARBYPk0qK/AAxCK X-Received: by 2002:a17:902:7882:: with SMTP id q2mr11032791pll.305.1550244938787; Fri, 15 Feb 2019 07:35:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550244938; cv=none; d=google.com; s=arc-20160816; b=zoSySAKjG+KT9LrEhmDPZYhh9G32/8Ff8KOR/V+/BxGacmPuba37p9jvz4FVXOcQGm nfGBwYE3pokPIMrQN6v1M9/q0FAUtRbi5Z33vyA5NVn2hSX5LoHNCbxxHlFLg4wY+BTR C49bXr5+sRCy6J29ovgkWSSax7JATPlTDEPuhMQPrAajEADHoCAWVQ8omk+wTdjvCQIw XNvZT+R4cdiX7DPgucw89qg0wMlqGRbf58YrNhfc9i42muGGU6zW1On9TDZ68g2ehUga ETSaYHDr1vmgzLTkXBtzg4tH5AUwE4RkSjgA0qCBwcFzhd3FGBMFuM9CWw50XOXSaS7A oQ9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=d36AgB+FqbIk/ltA0COgY/2J/z0AkXVW2tCe9o8bRF4=; b=fhQr7WDdg2CpUyk68M2KWt14Rman9bJeDRClIQNrNJKULGdaGWx2ODVRRBwkaRulcy kCwcMn+ywCHnS+o0QML3+HWy82FMMIbsm+4B7JiN7GBn2i09EMXEbsldMtcaf+4M97LA 52IGyTC3Syl+GgeNrGgwxuNoF+2yxKdW8F0hdqOB1lLDixmk/b081FAGpISXcagp0qqw c7PHOc5bYpuSZH+NBWMS9VTK4pO5JwgT4cOKt/6ia9o8Cp7lSTAbPvnHlZpexhloWMsm dGMLNu5aGwJISfw6N3wacMlEWZNG2YYOogV0fDEM+SjeUmp59BZ0sk3LUybNR4UXYlN8 buww== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cm8si6635886plb.47.2019.02.15.07.35.22; Fri, 15 Feb 2019 07:35:38 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403855AbfBOH42 (ORCPT + 99 others); Fri, 15 Feb 2019 02:56:28 -0500 Received: from mga06.intel.com ([134.134.136.31]:19024 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726335AbfBOH42 (ORCPT ); Fri, 15 Feb 2019 02:56:28 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 23:50:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,372,1544515200"; d="scan'208";a="126685015" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.151]) by orsmga003.jf.intel.com with ESMTP; 14 Feb 2019 23:50:23 -0800 From: "Huang\, Ying" To: Andrea Arcangeli Cc: Andrew Morton , , , Hugh Dickins , "Paul E . McKenney" , Minchan Kim , Johannes Weiner , Tim Chen , Mel Gorman , =?utf-8?Q?J=EF=BF=BDr=EF=BF=BDme_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 References: <20190211083846.18888-1-ying.huang@intel.com> <20190214023805.GA19090@redhat.com> <87k1i2oks6.fsf@yhuang-dev.intel.com> <20190214214741.GB10698@redhat.com> Date: Fri, 15 Feb 2019 15:50:21 +0800 In-Reply-To: <20190214214741.GB10698@redhat.com> (Andrea Arcangeli's message of "Thu, 14 Feb 2019 16:47:41 -0500") Message-ID: <87mumxa3sy.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrea Arcangeli writes: > 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. If CONFIG_PREEMPT_VOLUNTARY=y CONFIG_PREEMPT=n CONFIG_PREEMPT_COUNT=n which is common for servers, rcu_read_lock() will be a noop, rcu_read_lock_sched() and preempt_disable() will be barrier(). So rcu_read_lock() is a little better. > 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. Yes. Will change to rcu_read_lock/unlock based method. Best Regards, Huang, Ying