Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp242104pxf; Wed, 17 Mar 2021 04:20:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb1xFCLug3F+xz7KbhJR3eDTTa3uDiRMSEQ2IMRHy/XGyaThkMoy6M0QfNm7oG8CyVMMCt X-Received: by 2002:a50:ed90:: with SMTP id h16mr41583308edr.101.1615980028990; Wed, 17 Mar 2021 04:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615980028; cv=none; d=google.com; s=arc-20160816; b=rkPpDZn8gsK5LAitufeuLFC/tfpO6vBgAur178nkVBueksDD2wPMKWyiIHMSfK9pfQ oCwSUTp0xCWBE5HqGGI+2KSbXz1hwFwrAL+LDFTjev2/NQTRaqMHBn4dLVLkSL6+kq5N soZ7tkP2OGpLKbWU0MFGWDo2dT2c+QWIxKXG/ddzFzM3cmZvVDImC6UD2vUw/z+/PLxN s8VmDAWpcp0laUl3wrSt6nW0Tqp2kjNnWsN7K7xJgQ641FH1JZdRSqDRbAVZq1gBwzF0 judOwERAzYncQ+w0AOhGD2R19LM+Az8AIFwsCJsgmZrVuXGEzM9X59gyomn/K4wKDbGT bj2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=7ICFrnCYA6WU/nyO91rMalKC6CyiSa92VZImMiLqiv4=; b=A4xjPSw198KoljWO3yAXGGKTIFqm8Jva15JSEdX3G9WnW/BPGbd5l/RHuPsrPe3vvk Drw41lu4tJBIUILlVdk2bbKMxnCSfK4nBECApT61bqZQwWwJczId6aSlsogRjhnl/ucg u2rXvU7vlRgEVE2MO/STNPmFrGKRhDFFpC0oo9npSD8RVXnLLr3KEhKlkFDpfQQNsQ9P 1FSHJXeGpU3YGW0m3exLu/clDxOcj18XkaNyHme8S6r/db1rF8FPc8UCsAK7dDZDvTmc wc3lfNoeAneEWUlatWAqW6thmFfNH792UtQc3FfQOGLQicfRY9/isTvmSVIjsg13vcKE jWWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G+dZe7KX; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si15727525ejy.571.2021.03.17.04.20.06; Wed, 17 Mar 2021 04:20:28 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=G+dZe7KX; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230048AbhCQLSq (ORCPT + 99 others); Wed, 17 Mar 2021 07:18:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53643 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbhCQLSQ (ORCPT ); Wed, 17 Mar 2021 07:18:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615979895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7ICFrnCYA6WU/nyO91rMalKC6CyiSa92VZImMiLqiv4=; b=G+dZe7KXSMCZlQ18zc3jN1JhY7immZx2TnMhUMbeFsiek6w8GI11T0ZfXDuWmLf7RMbeyT FRKInE0KYUklwT2d53UXqSI+UGCohhKQHej4revogRIQfJPQROzvcc9pjnc1neBczLyDte TfryFGTAEAzOnibAPJ/LjW3lQVOicEg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-amxZMycaOZKvHSdvPBTREg-1; Wed, 17 Mar 2021 07:18:13 -0400 X-MC-Unique: amxZMycaOZKvHSdvPBTREg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87B43101371C; Wed, 17 Mar 2021 11:18:11 +0000 (UTC) Received: from [10.36.112.124] (ovpn-112-124.ams2.redhat.com [10.36.112.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FC03629DA; Wed, 17 Mar 2021 11:18:08 +0000 (UTC) Subject: Re: [PATCH v3 3/3] mm: fs: Invalidate BH LRU during page migration To: Minchan Kim , Andrew Morton Cc: 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 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> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <239b45ff-dad0-6cd0-4f6e-18159185cd6d@redhat.com> Date: Wed, 17 Mar 2021 12:18:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.03.21 19:26, Minchan Kim wrote: > 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. >> */ > Thanks, that makes more sense to me now :) > 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. s/migratoin/migration/ > * Skip putting upcoming bh into bh_lru until migration is done. > */ > if (lru_cache_disabled()) > Acked-by: David Hildenbrand -- Thanks, David / dhildenb