From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28B33C433EF for ; Fri, 21 Jan 2022 21:56:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 35FF66B0080; Fri, 21 Jan 2022 16:56:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E8586B0083; Fri, 21 Jan 2022 16:56:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1887A6B0085; Fri, 21 Jan 2022 16:56:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id 048886B0080 for ; Fri, 21 Jan 2022 16:56:37 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B03D7181CAEC0 for ; Fri, 21 Jan 2022 21:56:36 +0000 (UTC) X-FDA: 79055653992.28.F462D7C Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf12.hostedemail.com (Postfix) with ESMTP id 7F1DA40003 for ; Fri, 21 Jan 2022 21:56:35 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id v11-20020a17090a520b00b001b512482f36so7333001pjh.3 for ; Fri, 21 Jan 2022 13:56:35 -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=6UROzOU1Pbg/kG3n1ww3jU+iJD/9JRl3vNmRz/vX69enAJ6uZl7PBWDm2EEPwXN4Lw M/GZnMgXrl75Wegz9BAiai4GeujDNKazHmv9Tvl9aAe7YABFcdgrGBmjZxzmt381TJTy imfBkDpx85knOdPgoMSx66/HSOoKRZ9oNuWnmPrnQOtM5DHIcMHXbtb5ea3iq9P0ZhlG fTtiROqq8/IhtmoR/C7XbfuJbNEXUxjKN0HGDoBC0fsuJ0Tg2ypkr8c9yY1lBo4FY2AG +krLCzBbY79/Ad4e4VU8BF9wAfgcgdnoy11y+5N2V2w/nFG3bvPmH32yKp4Ov1E+/bCi AI1w== X-Gm-Message-State: AOAM530OmlSJJxfb0j/iARcME1w9w1viYbTyVeFsplGkXDaZolrXfI/l nIlP0dNIgTWEvt5FrKpsSc0= X-Google-Smtp-Source: ABdhPJydBlBHM5eX5KYl3wNuArOmn/hiQvWabvZkfPlhdTcqWMI16whV737dEy1Ohdrr3/+NP/GLFA== 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) 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: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 7F1DA40003 X-Stat-Signature: 5ecgtdhjygizpfgsbj5wuy3j5b87og94 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mz6hq5mp; spf=pass (imf12.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-HE-Tag: 1642802195-138527 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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