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=-14.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 7150FC433F5 for ; Tue, 7 Sep 2021 08:08:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4812A610FF for ; Tue, 7 Sep 2021 08:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241229AbhIGIJo (ORCPT ); Tue, 7 Sep 2021 04:09:44 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47686 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbhIGIJn (ORCPT ); Tue, 7 Sep 2021 04:09:43 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 909FD1FD5A; Tue, 7 Sep 2021 08:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1631002116; h=from:from:reply-to: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=mE+UDLIcmL0uf5lAoyfAWlHoJhKxjw6dpsgL05G4NQ4=; b=mRAP/NrRrqQUFpSKeAZRgroS1r3RKbtLICl+LW39SeaHzKW6zlok4QP4NQpMGFPGbrfMV7 qq64m8/88ZNOYO1gmeozwQiya9J7c1cHbxY8ozubmJlDEdlCtOYiZUsqfm+HEtINK+52ld rRPr164T9YzuLxKjAVKElMFxVO3fZDs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1631002116; h=from:from:reply-to: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=mE+UDLIcmL0uf5lAoyfAWlHoJhKxjw6dpsgL05G4NQ4=; b=ETUZPolDOc4zCar0SL81Gt7AIAEQFwY5ixnV3j/PWRfRIoqJwO/TGrErzQA3fsBO9njq3x fhMXqhEWd+cqVLCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7772613C50; Tue, 7 Sep 2021 08:08:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CHaNHAQeN2HvTwAAMHmgww (envelope-from ); Tue, 07 Sep 2021 08:08:36 +0000 Message-ID: Date: Tue, 7 Sep 2021 10:08:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.0.1 Subject: Re: [PATCH] mm/page_isolation: don't putback unisolated page Content-Language: en-US To: David Hildenbrand , Miaohe Lin , akpm@linux-foundation.org Cc: iamjoonsoo.kim@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210904091839.20270-1-linmiaohe@huawei.com> <3b36529f-ab97-ddfe-0407-66f0cd1fd38d@redhat.com> <2d06db75-5c26-8fe2-6883-ac99056a9894@redhat.com> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/6/21 14:49, David Hildenbrand wrote: > On 06.09.21 14:45, Miaohe Lin wrote: >> On 2021/9/6 20:11, David Hildenbrand wrote: >>> On 06.09.21 14:02, David Hildenbrand wrote: >>>> On 04.09.21 11:18, Miaohe Lin wrote: >>>> >>>> Thanks! >>>> >>>> Reviewed-by: David Hildenbrand >>>> >>> >>> To make the confusion perfect (sorry) :D I tripple-checked: >>> >>> In unset_migratetype_isolate() we check that is_migrate_isolate_page(page) holds, otherwise we return. >>> >>> We call __isolate_free_page() only for such pages. >>> >>> __isolate_free_page() won't perform watermark checks on is_migrate_isolate(). >>> >>> Consequently, __isolate_free_page() should never fail when called from unset_migratetype_isolate() >>> >>> If that's correct then we  could instead maybe add a VM_BUG_ON() and a comment why this can't fail. >>> >>> >>> Makes sense or am I missing something? >> >> I think you're right. __isolate_free_page() should never fail when called from unset_migratetype_isolate() >> as explained by you. But it might be too fragile to reply on the failure conditions of __isolate_free_page(). >> If that changes, VM_BUG_ON() here might trigger unexpectedly. Or am I just over-worried as failure conditions >> of __isolate_free_page() can hardly change? > > Maybe > > isolated_page = !!__isolate_free_page(page, order); > /* > * Isolating a free page in an isolated pageblock is expected to always > * work as watermarks don't apply here. > */ > VM_BUG_ON(isolated_page); > > > VM_BUG_ON() allows us to detect any issues when testing. Combined with > the comment it tells everybody messing with __isolate_free_page() what > we expect in this function. > > In production system, we would handle it gracefully. If this can be handled gracefully, then I'd rather go with VM_WARN_ON. Maybe even WARN_ON_ONCE?