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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ACF8C433DB for ; Tue, 16 Mar 2021 18:27:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 82C596513F for ; Tue, 16 Mar 2021 18:27:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82C596513F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 094A36B0036; Tue, 16 Mar 2021 14:27:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 045C96B006C; Tue, 16 Mar 2021 14:27:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E29EB6B006E; Tue, 16 Mar 2021 14:27:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id C4F2F6B0036 for ; Tue, 16 Mar 2021 14:27:06 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 778B2181AF5E6 for ; Tue, 16 Mar 2021 18:27:06 +0000 (UTC) X-FDA: 77926569252.11.F486DE4 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf06.hostedemail.com (Postfix) with ESMTP id EDB78C0007DE for ; Tue, 16 Mar 2021 18:27:03 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id s7so17352091plg.5 for ; Tue, 16 Mar 2021 11:27:03 -0700 (PDT) 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=D8YsQYBoQjPDDMW69OS6mCHbDqccTlAKm8s8N7LlDSk=; b=bmyjPih5zqJ7pZpcDaH7m0PIZ9CQebcwZosOmpNmVdTgNKeCj88xdUfEiyglhW/sNl jdbXG2f5TbDwQ3WL6aOH3pqusvQtJ6Uz1zKBVw7UwDRjE2dldL78J3HxWcxRoKUvqWwO knrJLtWuJThFIuQIEaHCxHxzvq7DaDBUkM4jsyyt7RVm6ehLjZkwstrEVp1rp9F2969S Fg10dRN0vN68RO82XUIOfBtHxp0BV9v48y06jReibl6eGayWUwnJCJmygDs6xH9BFJu/ E9XP+N5EkzKTFaVDuCxz/duW02o/M8hF6gVPqx8NPSMMvaTuAXuL0stX5a2tDron4guq zU2Q== 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=D8YsQYBoQjPDDMW69OS6mCHbDqccTlAKm8s8N7LlDSk=; b=Lq8Ys1tlnnAIT1x3ydTKT89Fm6qQnAoT+Qiw8UGaspPDAzH86Omvl4g2IsnMkvW2kz lndc1A6Squhj7k+LDUfaZG9W0EYf8q9RSAD3PnaFFvK5oqx5v10sonQRhCUS49uBNqmH /XNM1X9SMGqWqPmJ/ySWeMe0gY49wjBC6bGcm+7IKQHb3NZyW3FqvA1OgmDzMkXO/U01 nU090QLUmD9ErXH0d8Jz1mvalm93pKopZFaOBam1GgJ9ML8PPa07/BU+WrGs69kSzMvp /tBrk3190+U01/1kM443WcVfVbfkPy7roGSvELEmCk56s4s2v6AJ2+tBX73ZvFExIbnk EQrA== X-Gm-Message-State: AOAM530eCxrwCN8P/wwunKYuwKEiGedko8G+aD9fmrVXY7APdq/uKFIt 9+mCpDg3fs2Itn5tlTZwims= X-Google-Smtp-Source: ABdhPJxMeDodEibdMrTXnC8riuuAXLEO++SyWRb9epjcRt7KQF7yuxzfs9IwS+cyCHokDZhwzvUaLw== X-Received: by 2002:a17:902:7d8d:b029:e6:4061:b767 with SMTP id a13-20020a1709027d8db02900e64061b767mr704232plm.32.1615919222506; Tue, 16 Mar 2021 11:27:02 -0700 (PDT) Received: from google.com ([2620:15c:211:201:4160:1d48:d43e:7513]) by smtp.gmail.com with ESMTPSA id z1sm17220500pfn.127.2021.03.16.11.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 11:27:01 -0700 (PDT) Date: Tue, 16 Mar 2021 11:26:59 -0700 From: Minchan Kim To: David Hildenbrand , Andrew Morton Cc: Andrew Morton , linux-mm , LKML , joaodias@google.com, surenb@google.com, cgoldswo@codeaurora.org, willy@infradead.org, mhocko@suse.com, vbabka@suse.cz, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v3 3/3] mm: fs: Invalidate BH LRU during page migration Message-ID: References: <20210310161429.399432-1-minchan@kernel.org> <20210310161429.399432-3-minchan@kernel.org> <1bdc93e5-e5d4-f166-c467-5b94ac347857@redhat.com> <1527f16f-4376-a10d-4e72-041926cf38da@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EDB78C0007DE X-Stat-Signature: tt3ragu5oi9xp93inixfk6kuz7er5j6t Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf06; identity=mailfrom; envelope-from=""; helo=mail-pl1-f169.google.com; client-ip=209.85.214.169 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615919223-55867 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, Mar 12, 2021 at 09:17:23AM -0800, Minchan Kim wrote: > On Fri, Mar 12, 2021 at 10:33:48AM +0100, David Hildenbrand wrote: > > On 12.03.21 10:03, David Hildenbrand wrote: > > > On 10.03.21 17:14, Minchan Kim wrote: > > > > ffer_head LRU caches will be pinned and thus cannot be migrated. > > > > This can prevent CMA allocations from succeeding, which are often used > > > > on platforms with co-processors (such as a DSP) that can only use > > > > physically contiguous memory. It can also prevent memory > > > > hot-unplugging from succeeding, which involves migrating at least > > > > MIN_MEMORY_BLOCK_SIZE bytes of memory, which ranges from 8 MiB to 1 > > > > GiB based on the architecture in use. > > > > > > Actually, it's memory_block_size_bytes(), which can be even bigger > > > (IIRC, 128MiB..2 GiB on x86-64) that fails to get offlined. But that > > > will prevent bigger granularity (e.g., a whole DIMM) from getting unplugged. > > > > > > > > > > > Correspondingly, invalidate the BH LRU caches before a migration > > > > starts and stop any buffer_head from being cached in the LRU caches, > > > > until migration has finished. > > > > > > Sounds sane to me. > > > > > > > Diving a bit into the code, I am wondering: > > > > > > a) Are these buffer head pages marked as movable? > > > > IOW, are they either PageLRU() or __PageMovable()? > > > > > > b) How do these pages end up on ZONE_MOVABLE or MIGRATE_CMA? > > > > I assume these pages come via > > alloc_page_buffers()->alloc_buffer_head()->kmem_cache_zalloc(GFP_NOFS | > > __GFP_ACCOUNT) > > > > It's indirect it was not clear > > try_to_release_page > try_to_free_buffers > buffer_busy > failed > > Yeah, comment is misleading. This one would be better. > > /* > * the refcount of buffer_head in bh_lru prevents dropping the > * attached page(i.e., try_to_free_buffers) so it could cause > * failing page migrationn. > * Skip putting upcoming bh into bh_lru until migration is done. > */ Hi Andrew, Could you fold this comment fix patch? If you prefer formal patch, let me know. I will resend it. Thank you. >From 0774f21e2dc8220fc2be80c25f711cb061363519 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Fri, 12 Mar 2021 09:17:34 -0800 Subject: [PATCH] comment fix Signed-off-by: Minchan Kim --- fs/buffer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index ca9dd736bcb8..8602dcbe0327 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1265,8 +1265,9 @@ static void bh_lru_install(struct buffer_head *bh) check_irqs_on(); /* - * buffer_head in bh_lru could increase refcount of the page - * until it will be invalidated. It causes page migraion failure. + * the refcount of buffer_head in bh_lru prevents dropping the + * attached page(i.e., try_to_free_buffers) so it could cause + * failing page migratoin. * Skip putting upcoming bh into bh_lru until migration is done. */ if (lru_cache_disabled()) -- 2.31.0.rc2.261.g7f71774620-goog