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 2C895ECAAD8 for ; Tue, 20 Sep 2022 10:55:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 97707940008; Tue, 20 Sep 2022 06:55:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FFBE940007; Tue, 20 Sep 2022 06:55:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A158940008; Tue, 20 Sep 2022 06:55:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 67802940007 for ; Tue, 20 Sep 2022 06:55:46 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 343E2A0AB2 for ; Tue, 20 Sep 2022 10:55:46 +0000 (UTC) X-FDA: 79932158292.30.D538553 Received: from outbound-smtp17.blacknight.com (outbound-smtp17.blacknight.com [46.22.139.234]) by imf16.hostedemail.com (Postfix) with ESMTP id 90F32180032 for ; Tue, 20 Sep 2022 10:55:45 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp17.blacknight.com (Postfix) with ESMTPS id 2740E1C3940 for ; Tue, 20 Sep 2022 11:55:44 +0100 (IST) Received: (qmail 10386 invoked from network); 20 Sep 2022 10:55:43 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 20 Sep 2022 10:55:43 -0000 Date: Tue, 20 Sep 2022 11:55:39 +0100 From: Mel Gorman To: Zhaoyang Huang Cc: "zhaoyang.huang" , Andrew Morton , "open list:MEMORY MANAGEMENT" , LKML , Ke Wang Subject: Re: [PATCHv2] mm: check high-order page when free it to pcp Message-ID: <20220920105539.lfaqutj5lz3j5dux@techsingularity.net> References: <1663634940-6515-1-git-send-email-zhaoyang.huang@unisoc.com> <20220920085437.ngyrzgxe2uoi7g4a@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663671345; 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: in-reply-to:in-reply-to:references:references; bh=I4KqsMp36I03GiiWYCYUVxJkNmQU7s2ZKOwOHwD3OYg=; b=mytYvBB8BHrFlZ+Pz1xNXsAM/JjpxsbqEaIVJv0klVXETP41G9bKSzGBpLJomSGuRRd37D /QuMeB4I5hb6N5AuzQUGEqXg6jac54plhImXLR1uInPqRterXtcmonOp2C58tB1mjIOIEI mFS1z/QJzdF7u1blTvY5+ES1tyAQQr8= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.234 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663671345; a=rsa-sha256; cv=none; b=CzCtx46Z5hbm67hlSEu2UXWz+6pCCe2o8HSPGcewo+S7jCQUjuMHvqpu/ynGIHSPgWKBs2 OTSkjxmQC35j0Yj7071PedgQ/4QgHL9A5p+hJpU4ctJyGG+cjkILDzomyJloL6QG2nyhkE gXZ7lqe8XgdpG5qASEQuDDfOAbpIy3I= X-Stat-Signature: 9791ubh1oknhekjdicnczjyc8spazuk6 X-Rspam-User: X-Rspamd-Queue-Id: 90F32180032 X-Rspamd-Server: rspam02 Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.234 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none X-HE-Tag: 1663671345-636140 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 Tue, Sep 20, 2022 at 05:07:33PM +0800, Zhaoyang Huang wrote: > On Tue, Sep 20, 2022 at 4:55 PM Mel Gorman wrote: > > > > On Tue, Sep 20, 2022 at 08:49:00AM +0800, zhaoyang.huang wrote: > > > From: Zhaoyang Huang > > > > > > High-order pcp page escaped from checking when both of DEBUG_VM and debug_pagealloc > > > are all disabled if it allocated again from pcp_list without going to global > > > free list, which should be introduced by 44042b4498. > > > > > > fix:44042b4498 > > > > > > Signed-off-by: Zhaoyang Huang > > > > Why is the order check needed? In this case, I think the comment itself was > > wrong and should be corrected. free_pcp_prepare is called when dealing with > > a PCP page being freed and these days that may order-0 or high-order pages. > > Wieh DEBUG_VM disabled, the pages are checked in by bulkfree_pcp_prepare > > when freeing pages from PCP to the core allocator. Why would just > > high-order pages be checked in free_pcp_prepare and checked again in > > bulkfree_pcp_prepare? > > for high-order pcp pages(head page in fact), they might escape from > bulkfree_pcp_prepare if they were allocated from pcp-list > again(pcp->count < high) prior to going to core allocator. This is expected. The DEBUG_VM checks when enabled are more paranoid and are more likely to catch corruption or a use-after-free issue. For !DEBUG_VM, there is partial checking which is faster but leaves the possibility that a corruption of struct page will be missed. -- Mel Gorman SUSE Labs