Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1624747pxb; Sat, 22 Jan 2022 01:41:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUsn4U9eN5eu1pyPEkQD0JxANey4eKAygAkSOSDSrOrIk9HGdR4jjq5hieBLgnKwiDwiTX X-Received: by 2002:a63:904c:: with SMTP id a73mr5582096pge.449.1642844488079; Sat, 22 Jan 2022 01:41:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642844488; cv=none; d=google.com; s=arc-20160816; b=ErZRNhGe28M4JGhQpi3WjufXYxZxz9sEy1MHNRXAsutUX47//B53aGR7/ZCNj9fdc/ AIDYQyLzSSsMgmcnbh3oS7MSVj2jJmhXqu8JSsoy7GwCHS+gWNNaCn+Pt5taQIEfcBDl 5O1VZJrPAhoLtnuTCpDG7bIwgTJcfNpBICD1ezwTXCE4WmvrUmSvvLAsaN8hi0hPEc0k xKORTdRku2bSmo0jsD62IxNIi7FxyfIAyXdm1I8unUeC3Is2fZCNkTmK49n9DAWasUwQ sLAMGLBBRn0RMcDo5HAX57M3LrTB5CQz3KHp9JYl0IzVORx1sV8v32CGVxaPSqSutxhy PplQ== 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=WB/i8Zno/EA3UrQ+waTtgBHLjvayEDHdGDDDKHDQtoY=; b=mDEm/vK57ucOmeTDAgaqdeRfLLY7kvmvFtprEqnIGGMgmU3hV5+6nStlMTufg+/k19 yb2+DuS5Z2ne3HkMCdMhiPhNierqzKHAuqw5j0pME6AIy2wftYF790HliRSPWnW/vZhu PnLXQ5FItpnaPzhfk9PBzEv6xm1ta3zM6hnR/7UXEsJp7iZ378nY1tgaxZkx4gOK31NY ML6zUYp/ZULsPvLtN5OFY/R/G88wItlfiPuyUmOTzEXhA+WzlVnL0ZnUJNlxcAkr5HGY rqBqjv9qGMqlt9ABLno1zPVE68xFfjjdrH58JxLJ15BhoXOG3tkHH5QkEMHzwbqjdzCS LsDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mz6hq5mp; 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 j9si7563129plt.308.2022.01.22.01.41.15; Sat, 22 Jan 2022 01:41:28 -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=20210112 header.b=mz6hq5mp; 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 S232127AbiAUV4i (ORCPT + 99 others); Fri, 21 Jan 2022 16:56:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231180AbiAUV4f (ORCPT ); Fri, 21 Jan 2022 16:56:35 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D08C06173B for ; Fri, 21 Jan 2022 13:56:34 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id s2-20020a17090ad48200b001b501977b23so9747483pju.2 for ; Fri, 21 Jan 2022 13:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WB/i8Zno/EA3UrQ+waTtgBHLjvayEDHdGDDDKHDQtoY=; b=mz6hq5mpAMEhKxZp313MsiLVlDOudEcTc/cLj3qPUUHOWVR50CWEjpAPxkIPz2lE7N QEjl9CL9ShR2o3RrnURvsVwjdaOTBG0wk5bjgBBz0fKCGKnnJxgp0ZTocainI0UVmaPr 5Qq040Klo/mPPMwviNYREtRHRrjwYVOWfOHa4/Bfh0Q+kBXvbD+CcdZ5yJr4Dwk20Ai9 CatHFs2OJIiDBRXCRm8EWqC3D93I6uBsiJoaHxtWC5zq8q88+IcoMU4wt7r2kumebra8 ZSErCUvkSmOQMD7E1yEhY5scrlW5huUsieGOSc38gF3u5Dl3aUoEo9Oy3v9btf0F0wna bZhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=WB/i8Zno/EA3UrQ+waTtgBHLjvayEDHdGDDDKHDQtoY=; b=BiE/2e/mb95j1tXu1Y9016pl2hRe9rD5vX+ZqcUApiNGuM35GKm3YrZ3aKQybKGGBy Yb/YkQ7h4znH3QU1AA5wn90zsbInGfvUIAToN1o3li0LrCSrrJHftwjlWykQLB1xaMh+ F0QkHPug4/qfDUWMgINSQB5Nd6HD2+KXTKz5RbnS8QzvhB0Cv7r69cSBaShKOKe8wRrQ Kn5/sVhHBdmaRU8VXz18mIrNxJfCI6nbneei5hF7xbEgHtotTO/UK0r+OsQLzCqWw9UP M7M0EzXycfYz5tw10/pzowz2oaqeLS1YyCYbqvIBWAbARyvE1ShURVYQExyo1TVaDWNw fqiA== X-Gm-Message-State: AOAM533Ib6tPMT67/Ui6estddvoxaci5AnuTmoSUYnWV4HchaYD7YGPT hcKRyhuqTh9jHoF2yIqgPf8= X-Received: by 2002:a17:902:b414:b0:142:431f:3d1c with SMTP id x20-20020a170902b41400b00142431f3d1cmr5537210plr.32.1642802194129; Fri, 21 Jan 2022 13:56:34 -0800 (PST) Received: from google.com ([2620:15c:211:201:8ee4:9dbe:c4bd:f5f8]) by smtp.gmail.com with ESMTPSA id r19sm5928935pjz.6.2022.01.21.13.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 13:56:33 -0800 (PST) Sender: Minchan Kim Date: Fri, 21 Jan 2022 13:56:31 -0800 From: Minchan Kim To: Michal Hocko Cc: Andrew Morton , David Hildenbrand , linux-mm , LKML , Suren Baghdasaryan , John Dias Subject: Re: [RESEND][PATCH v2] mm: don't call lru draining in the nested lru_cache_disable Message-ID: References: <20211230193627.495145-1-minchan@kernel.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 Fri, Jan 21, 2022 at 10:59:32AM +0100, Michal Hocko wrote: > On Thu 20-01-22 13:07:55, Minchan Kim wrote: > > On Thu, Jan 20, 2022 at 09:24:22AM +0100, Michal Hocko wrote: > > > On Wed 19-01-22 20:25:54, Minchan Kim wrote: > > > > On Wed, Jan 19, 2022 at 10:20:22AM +0100, Michal Hocko wrote: > > > [...] > > > > > What does prevent you from calling lru_cache_{disable,enable} this way > > > > > with the existing implementation? AFAICS calls can be nested just fine. > > > > > Or am I missing something? > > > > > > > > It just increases more IPI calls since we drain the lru cache > > > > both upper layer and lower layer. That's I'd like to avoid > > > > in this patch. Just disable lru cache one time for entire > > > > allocation path. > > > > > > I do not follow. Once you call lru_cache_disable at the higher level > > > then no new pages are going to be added to the pcp caches. At the same > > > time existing caches are flushed so the inner lru_cache_disable will not > > > trigger any new IPIs. > > > > lru_cache_disable calls __lru_add_drain_all with force_all_cpus > > unconditionally so keep calling the IPI. > > OK, this is something I have missed. Why cannot we remove the force_all > mode for lru_disable_count>0 when there are no pcp caches populated? Couldn't gaurantee whether the IPI is finished with only atomic counter. CPU 0 CPU 1 lru_cache_disable lru_cache_disable ret = atomic_inc_return ret = atomic_inc_return lru_add_drain_all(ret == 1); lru_add_drain_all(ret == 1) IPI ongoing skip IPI alloc_contig_range fail .. .. IPI done