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=-19.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,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 46671C432BE for ; Thu, 2 Sep 2021 12:09:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CB2E0610CF for ; Thu, 2 Sep 2021 12:09:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CB2E0610CF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 374A18D0002; Thu, 2 Sep 2021 08:09:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 325A08D0001; Thu, 2 Sep 2021 08:09:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EC0E8D0002; Thu, 2 Sep 2021 08:09:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 0E1CE8D0001 for ; Thu, 2 Sep 2021 08:09:14 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9BD8E1803EF2B for ; Thu, 2 Sep 2021 12:09:13 +0000 (UTC) X-FDA: 78542512986.03.81B4AA1 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf17.hostedemail.com (Postfix) with ESMTP id 0A187F00038D for ; Thu, 2 Sep 2021 12:09:12 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 774AA2034E; Thu, 2 Sep 2021 12:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1630584551; 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=IYZpsfq6AVlzLfpcEqifrWBELjivdYHFpOH84L0ZLXQ=; b=EJRH8W+p/m6uqdDMja7FOt44cgsMXcmX234zofIjn0ZyqFPP4Y/li8+avvoURuhM50A1XB /bnDisnVVHBQLXf1dSkEXVN87UwwjlUbUKOkFgr3lPWYXv3o8Kq6EgGM0Ol1YZKlZiwwe7 CSULrO4PqjOIUD7CkI3ouabTR1DoxKw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1630584551; 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=IYZpsfq6AVlzLfpcEqifrWBELjivdYHFpOH84L0ZLXQ=; b=guJ2NYobLeNN/a6z/K5U+meE3gXsmEPHBnGib93e1WLppGLVGY94oBEIiszCoxoqdAfP0S xdpzrLrEzcK1YrDQ== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 5432613732; Thu, 2 Sep 2021 12:09:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id /OBIE+e+MGGwfwAAGKfGzw (envelope-from ); Thu, 02 Sep 2021 12:09:11 +0000 Message-ID: Date: Thu, 2 Sep 2021 14:09:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Subject: Re: [PATCH v2] mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype Content-Language: en-US To: Miaohe Lin , akpm@linux-foundation.org Cc: peterz@infradead.org, mgorman@techsingularity.net, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210902115447.57050-1-linmiaohe@huawei.com> From: Vlastimil Babka In-Reply-To: <20210902115447.57050-1-linmiaohe@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=EJRH8W+p; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=guJ2NYob; dmarc=none; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0A187F00038D X-Stat-Signature: 9tgijufh4fasy5kcht9co3hfm3imrtop X-HE-Tag: 1630584552-888230 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/2/21 13:54, Miaohe Lin wrote: > If it's not prepared to free unref page, the pcp page migratetype is > unset. Thus We will get rubbish from get_pcppage_migratetype() and > might list_del &page->lru again after it's already deleted from the > list leading to grumble about data corruption. > > Fixes: df1acc856923 ("mm/page_alloc: avoid conflating IRQs disabled with zone->lock") > Signed-off-by: Miaohe Lin > Acked-by: Mel Gorman > Cc: Acked-by: Vlastimil Babka > --- > mm/page_alloc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 9c09dcb24149..a3c6acafa478 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3420,8 +3420,10 @@ void free_unref_page_list(struct list_head *list) > /* Prepare pages for freeing */ > list_for_each_entry_safe(page, next, list, lru) { > pfn = page_to_pfn(page); > - if (!free_unref_page_prepare(page, pfn, 0)) > + if (!free_unref_page_prepare(page, pfn, 0)) { > list_del(&page->lru); > + continue; > + } > > /* > * Free isolated pages directly to the allocator, see >