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 28B03CE79AD for ; Wed, 20 Sep 2023 06:07:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3E046B00A6; Wed, 20 Sep 2023 02:07:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9ED646B00CC; Wed, 20 Sep 2023 02:07:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88DFF6B00B7; Wed, 20 Sep 2023 02:07:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 743706B00A2 for ; Wed, 20 Sep 2023 02:07:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3C424140BFA for ; Wed, 20 Sep 2023 06:07:58 +0000 (UTC) X-FDA: 81255945036.09.E6BCC21 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf28.hostedemail.com (Postfix) with ESMTP id 0DB0AC0021 for ; Wed, 20 Sep 2023 06:07:55 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=i6wTg7u3; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=1SZIr55G; spf=pass (imf28.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695190076; h=from:from:sender: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:dkim-signature; bh=se+KZYftOIBUnwMWyj6AIrStZz8EeoGJhUCJe5qxccM=; b=EO7gTlU0G9E1osF2r9v2/D2RGm3M4kmzSZlMb3I6vfBl8V+whH4YFrzjk1vzffwCYFonb+ NBNjQdhUqvWPu28L2p2y3o5pZhuy6hL5HVfV82YGU48M0mg3aM3NijAjsVlbIf6pCmbmiv WAc3dImIEykSJnC5MwtzrkH4e8i8kIE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695190076; a=rsa-sha256; cv=none; b=WuM+HO8MoQ0vi0Py366hHK0+zbVYCplPICkoA3Jnd7u/F2oGSixzj3x2Ae8VFuns5cr4+5 pcchUrLiqBjluSH5aec5yC5lUHder6fm2Mzb8oSng5wiOEoQt94Bvvk3mLo4khgCtpG/wI YmyGNbFtT9DFeQgB9cUwuzhMtbEgpKk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=i6wTg7u3; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=1SZIr55G; spf=pass (imf28.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none 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 D66331F45B; Wed, 20 Sep 2023 06:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1695190073; 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=se+KZYftOIBUnwMWyj6AIrStZz8EeoGJhUCJe5qxccM=; b=i6wTg7u3h8G4w3VCeriFi2y8sONvVPDvRw8npOymVr3S+O2Misb8wuhDIvlZq935VPzqbL /lGaopi8TtPP4ZUhrW1/ugQyP3OO8ZB9vfMHzg4pxU5jS1WSKDlMhXbmWrqB7hQdQiNwkM rATEZSsx0GH+t0SSjS9t0joWT2UTu04= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1695190073; 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=se+KZYftOIBUnwMWyj6AIrStZz8EeoGJhUCJe5qxccM=; b=1SZIr55G08CSCrHOvzVZqzG9EJuGpQsUPUnWrQO5aEOQQLp8YMS0PkAvmyPVFeW3Q44v/7 3S1CaBRembpSejBQ== 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 B1D2E132C7; Wed, 20 Sep 2023 06:07:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gJieKjmMCmW0CgAAMHmgww (envelope-from ); Wed, 20 Sep 2023 06:07:53 +0000 Message-ID: Date: Wed, 20 Sep 2023 08:07:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH V2 0/6] mm: page_alloc: freelist migratetype hygiene To: Zi Yan , Mike Kravetz Cc: Johannes Weiner , Andrew Morton , Mel Gorman , Miaohe Lin , Kefeng Wang , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230911195023.247694-1-hannes@cmpxchg.org> <20230914235238.GB129171@monkey> <20230915141610.GA104956@cmpxchg.org> <20230916195739.GB618858@monkey> <20230918145204.GB16104@cmpxchg.org> <20230918174037.GA112714@monkey> <20230919064914.GA124289@cmpxchg.org> <20230919184731.GC112714@monkey> <20230920003239.GD112714@monkey> <149ACAE8-D3E4-4009-828A-D3AC881FFB9C@nvidia.com> Content-Language: en-US From: Vlastimil Babka In-Reply-To: <149ACAE8-D3E4-4009-828A-D3AC881FFB9C@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: xm8yufdnupbg13sqi9ujb5gc7wb5p364 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 0DB0AC0021 X-Rspam-User: X-HE-Tag: 1695190075-386697 X-HE-Meta: U2FsdGVkX1+A84UbGMLuqHDbAR648IFxoLe/rr1851OY7TwHs8ImiVmCh5Af+HVYoVXVgw78+jhnpgrm42HbKeMgTmAqfCMrp3ckL/42y8hpAEN+LfNRWEEZDyJoRkRPsBkqk2UHtqOstFKF9eDPhSHXORYfi+EE3CdRHYIR/7NR7y2XvdjQGI6KlmhKaNWclwljnwHBNzQcTWxbtxqq76S+jjRptEJMZibh3xZ+ODjHCLoFeOr4+/4yTbxFzm+CcgYUidqJr/YyeLLj1kvN0mjrhFEsomXTbi7Lr50hlXx4sS+K9zdUa40HBSf2axWeOjRu4X/8q+Sx0njGfPQZV5RthJdUQqACCNI9PhXO5AH1FFaZvV2k2ceSoa0XOebZqeiDqXqm5nDX6I+xzi9LrgmJNSTUt02DIIqoeLtPr/tp+G88axSdzcu6hNSvt+8ud/0bVVqNvOsKyMxvEJ2lzc3d429BC3ofabZPHNC8p5uprWlC7kln71v5iwPP0SpANGzbaNfQbJTMkse/FGXW6Bfp8RVd9tjFLXgL5P97y4DB1+xeNT3l2eUl4FQ07nVtxCJ1UYI3/ryryixrk502yvZXJMYdiSlOE7ePWJPFxhzoBKg5rbC0iCXUTvtE2EdNvOoMjG9MVVXONNyz6BSaep4bxryvsHXRlWOfqo8u4PNmB3Pf+vmCqx8r9Ror0oVP88N5x14OlYkTvalW+DA4qpsSjTU21FcpPbuIvQMH2kwGpsLfiYJuxhizIeucHq7ntUjPhMW9LNT+4WUjG3EXFZPQt7/K2x68kosnrRUcMSflEoUEZnmq7K2IZWL3FpruqOVmhPAENHdKkiDOGlShXg4GEjPiumeNXHLt7DNkw8MQ1YPZBHuRXaHM3wrwkcWL7H2ZAoVWtuZ+9/AGYzD6kCH+jE0NxsmJIFYru1q8ujU64jK4fxijcAzRvIqOXC4+sZyVngc1UG2X+S1XzlO 1Hpm8ADx KvW12JzWUdtzBJvVcvmKxrg+6fcYmdA2LSH9xIs1bu2ItAFR7mEMlg8jsvb3gATuNuvEBxrn6IQRljaZlgi96v1ngbzLu8zdkJ7rS1k81GxGNhNAyjwh0FQkvLEKdIpPZEvfK0/Ss+mVHKZjjOPpbvpTd2QtUwlnn9vQatNjdF7Ui68P7SZ+/8tSrxHuFrQirzeEJWJyjDTtRdml2Tvmuh7mIHJ8Qy3UuKI1CpG6OoEu2vMdEYCDhoXqlamJebmEbymTP6R7wjq1NDLh878MSRRXKre7qB/+S2HePza7LhNPb5NU= 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 9/20/23 03:38, Zi Yan wrote: > On 19 Sep 2023, at 20:32, Mike Kravetz wrote: > >> On 09/19/23 16:57, Zi Yan wrote: >>> On 19 Sep 2023, at 14:47, Mike Kravetz wrote: >>> >>>> --- a/mm/page_alloc.c >>>> +++ b/mm/page_alloc.c >>>> @@ -1651,8 +1651,13 @@ static bool prep_move_freepages_block(struct zone *zone, struct page *page, >>>> end = pageblock_end_pfn(pfn) - 1; >>>> >>>> /* Do not cross zone boundaries */ >>>> +#if 0 >>>> if (!zone_spans_pfn(zone, start)) >>>> start = zone->zone_start_pfn; >>>> +#else >>>> + if (!zone_spans_pfn(zone, start)) >>>> + start = pfn; >>>> +#endif >>>> if (!zone_spans_pfn(zone, end)) >>>> return false; >>>> I can still trigger warnings. >>> >>> OK. One thing to note is that the page type in the warning changed from >>> 5 (MIGRATE_ISOLATE) to 0 (MIGRATE_UNMOVABLE) with my suggested change. >>> >> >> Just to be really clear, >> - the 5 (MIGRATE_ISOLATE) warning was from the __alloc_pages call path. >> - the 0 (MIGRATE_UNMOVABLE) as above was from the alloc_contig_range call >> path WITHOUT your change. >> >> I am guessing the difference here has more to do with the allocation path? >> >> I went back and reran focusing on the specific migrate type. >> Without your patch, and coming from the alloc_contig_range call path, >> I got two warnings of 'page type is 0, passed migratetype is 1' as above. >> With your patch I got one 'page type is 0, passed migratetype is 1' >> warning and one 'page type is 1, passed migratetype is 0' warning. >> >> I could be wrong, but I do not think your patch changes things. > > Got it. Thanks for the clarification. >> >>>> >>>> One idea about recreating the issue is that it may have to do with size >>>> of my VM (16G) and the requested allocation sizes 4G. However, I tried >>>> to really stress the allocations by increasing the number of hugetlb >>>> pages requested and that did not help. I also noticed that I only seem >>>> to get two warnings and then they stop, even if I continue to run the >>>> script. >>>> >>>> Zi asked about my config, so it is attached. >>> >>> With your config, I still have no luck reproducing the issue. I will keep >>> trying. Thanks. >>> >> >> Perhaps try running both scripts in parallel? > > Yes. It seems to do the trick. > >> Adjust the number of hugetlb pages allocated to equal 25% of memory? > > I am able to reproduce it with the script below: > > while true; do > echo 4 > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages& > echo 2048 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages& > wait > echo 0 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages > echo 0 > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages > done > > I will look into the issue. With migratetypes 0 and 1 and somewhat harder to reproduce scenario (= less deterministic, more racy) it's possible we now see what I suspected can happen here: https://lore.kernel.org/all/37dbd4d0-c125-6694-dec4-6322ae5b6dee@suse.cz/ In that there are places reading the migratetype outside of zone lock.