Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7465842pxb; Thu, 18 Feb 2021 10:44:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0O6OrmS2zZUf1xFGmAMJj7BAv0FS6c1iKWsVF3xKzB8EaLmhumAsPR03DeRht51M26tdk X-Received: by 2002:a17:906:11d5:: with SMTP id o21mr5136634eja.504.1613673853747; Thu, 18 Feb 2021 10:44:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613673853; cv=none; d=google.com; s=arc-20160816; b=jtuNXeVIdV1lQHRgm3zslG47cv1W4vOvdrzdP8AY6vMAQh/PSMOwJZ9hiVJZhlZLnX LF+pTITVaKc9tJu4cf6UoFGupIWRWpTQ9tFTGAkN2dGitkSZAoQptV3gRZqrehvnic4Q OvABfORyVqcFUG5erfyxrX/omaPQRGrOQEhcogTnQVgS+JZ9pkAPhdhgBDXH/wgSeQEk DnjX9UoUQ0le9rV3lQz0KMtFHDDT04fDOXnPdECmi082R0yOC1zBYi+kTytFH20Zjr/D CWUz5B0najOyHfjtJbxLB0/kSZ6qJYx7CAQFsKZz546xqnCTDvCA7AEHPtblsCtaySRQ Pfew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=7vviwcmISf9SauaMuvs/shrly/ZIB570cD7CHEN4n8M=; b=woVX5ri1qT0nsjO5VpV4+ki0F83Hl6vkBwV7KJ1PPEL4MW1FkSWGKSzHPST0PnvWsc km3r3opfUZqRvOeCF7/mmpc9+XH+CZMODgSftsEKqHL+qllSJebHOtRBhdkAoqO8AWDQ Hlim7feUctfH5Kez4fBa+YDozfeCtohWghDgFgF0E+R/1G6HnbR+SoNoRAb49AiQaEby ez3P9EtMQDdN8KwTaoJM8aM7IJUHqzGVbhoz6XSv+FLC2rcmIbISrzMVvsVA7Zam/PoO b+quf262qdOew5HxxwkLRb0QHBT61FQ6M+T1a1scDnOsRhd4uYtghpr3jIcqRkedE4aF UDGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aee4RfHC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si4340367eju.730.2021.02.18.10.43.49; Thu, 18 Feb 2021 10:44:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aee4RfHC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232719AbhBRSnA (ORCPT + 99 others); Thu, 18 Feb 2021 13:43:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233274AbhBRQWh (ORCPT ); Thu, 18 Feb 2021 11:22:37 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05354C0613D6; Thu, 18 Feb 2021 08:21:56 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id e9so1794093pjj.0; Thu, 18 Feb 2021 08:21:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7vviwcmISf9SauaMuvs/shrly/ZIB570cD7CHEN4n8M=; b=aee4RfHC3S11MQQnocAxac6OvJxnqTUJpJs6OeBXqnvBK7VUpL3Rq16ldY2nn4n7Mm Qdqf6nGxbqEbQdiMAY7X0nsfgi/8/O7Osio/lFdO2BdTpVvx/ILfACQpZf59JSfEK8/H aS+i5uAZM/UTzYRHFcUaJI6owz3dZBSCmdFwy2INXL1GtDtHyebkQ4Hph66cUvFQGBfA lerhWNQ/XXlU1Y5hdXQIVa/iZLTaETmlghxAFW4Wh6RmbtgkI4wETNGD3E/iDmVSBa3j z5z9zpGAoAbpuCyDlvWyM0QYJzQRYgwh6AN1+goDsZ5ESYNUh+yfM+pRXPB0tWkLZzO3 8UHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=7vviwcmISf9SauaMuvs/shrly/ZIB570cD7CHEN4n8M=; b=p9AcU+pDfnlcXPrBeZZdrdpoWtz9kSIKXFp8Q2dBht7IMDduIKZyZJ2S7qCoEnE/KZ 2s7BbLiQzzCvyIvVkfQzaMunFPM8C68d2bpmNhhSPrcoEZA68p9xHBhTV/AIv5DjP9Ph 6ZvetPY1/GUbt0afnXvQCKGYa+YsufIy0Pc+bHTDz2zbFq3zm+kgFPRhBZIPU0yH0squ 6Ge5xcMcG0BDqjgywGYKmAfZFjrxzuQXeEjCMy44vc6dDTXLiIm8VlXxnQ0IDtA6b2kN V+IUmj4JMLkJmThHN0UxkZZbWg1UGDsb1VYoWGJTMV1l+ZnSxSDmTbq/+6U17BONPISb HHHg== X-Gm-Message-State: AOAM533AtQHLWC5qc6WQC4Asujt0hRqs2lKyaCveTRgn6UOCBuwkFA+g MRu64omAmkSYFCkO+JUsFig= X-Received: by 2002:a17:902:6bca:b029:e2:c5d6:973e with SMTP id m10-20020a1709026bcab02900e2c5d6973emr4655370plt.40.1613665315616; Thu, 18 Feb 2021 08:21:55 -0800 (PST) Received: from google.com ([2620:15c:211:201:157d:8a19:5427:ea9e]) by smtp.gmail.com with ESMTPSA id x17sm6727848pfq.132.2021.02.18.08.21.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 08:21:54 -0800 (PST) Sender: Minchan Kim Date: Thu, 18 Feb 2021 08:21:52 -0800 From: Minchan Kim To: Michal Hocko Cc: Matthew Wilcox , Andrew Morton , linux-mm , LKML , cgoldswo@codeaurora.org, linux-fsdevel@vger.kernel.org, david@redhat.com, vbabka@suse.cz, viro@zeniv.linux.org.uk, joaodias@google.com Subject: Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily Message-ID: References: <20210216170348.1513483-1-minchan@kernel.org> <20210217211612.GO2858050@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 18, 2021 at 05:08:58PM +0100, Michal Hocko wrote: > On Thu 18-02-21 07:52:25, Minchan Kim wrote: > > On Thu, Feb 18, 2021 at 09:17:02AM +0100, Michal Hocko wrote: > > > On Wed 17-02-21 13:32:05, Minchan Kim wrote: > > > > On Wed, Feb 17, 2021 at 09:16:12PM +0000, Matthew Wilcox wrote: > > > > > On Wed, Feb 17, 2021 at 12:46:19PM -0800, Minchan Kim wrote: > > > > > > > I suspect you do not want to add atomic_read inside hot paths, right? Is > > > > > > > this really something that we have to microoptimize for? atomic_read is > > > > > > > a simple READ_ONCE on many archs. > > > > > > > > > > > > It's also spin_lock_irq_save in some arch. If the new synchonization is > > > > > > heavily compilcated, atomic would be better for simple start but I thought > > > > > > this locking scheme is too simple so no need to add atomic operation in > > > > > > readside. > > > > > > > > > > What arch uses a spinlock for atomic_read()? I just had a quick grep and > > > > > didn't see any. > > > > > > > > Ah, my bad. I was confused with update side. > > > > Okay, let's use atomic op to make it simple. > > > > > > Thanks. This should make the code much more simple. Before you send > > > another version for the review I have another thing to consider. You are > > > kind of wiring this into the migration code but control over lru pcp > > > caches can be used in other paths as well. Memory offlining would be > > > another user. We already disable page allocator pcp caches to prevent > > > regular draining. We could do the same with lru pcp caches. > > > > I didn't catch your point here. If memory offlining is interested on > > disabling lru pcp, it could call migrate_prep and migrate_finish > > like other places. Are you suggesting this one? > > What I meant to say is that you can have a look at this not as an > integral part of the migration code but rather a common functionality > that migration and others can use. So instead of an implicit part of > migrate_prep this would become disable_lru_cache and migrate_finish > would become lruc_cache_enable. See my point? > > An advantage of that would be that this would match the pcp page > allocator disabling and we could have it in place for the whole > operation to make the page state more stable wrt. LRU state (PageLRU). Understood. Thanks for the clarification.