Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3741271rwb; Tue, 20 Sep 2022 04:11:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73CFxe1XSCxcmcKhc02t8z1MM+L6ILn0VelE4cGgCxyF3CYm8AUMrwBAQm43LaWx+B3cYa X-Received: by 2002:a05:6402:510f:b0:451:624f:2f02 with SMTP id m15-20020a056402510f00b00451624f2f02mr19242859edd.40.1663672288165; Tue, 20 Sep 2022 04:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663672288; cv=none; d=google.com; s=arc-20160816; b=rvzxYy1Pna9LuIwmumWB2yvMHAKoqtbpVXIh1YqsFaZyeaOKu3QbnES9EXwxaeIq8W 0p+p4p4FAAetNCAu/S9r8x4i2w4Zr2B+X/WLKoYCPbQyOUMuVES7p3rEOhAVoL3VFYRH H36Z8iwnVMoW1CQr0vdvv5ry3bmd7oV1XltxdPhrhsizgRUXf6Ks+5hlOuFf3zKF7QLc KlaMoETN/j+PE6vBV0C9SHBgB5I09kXddKA8hv6wRpS9Vx74S5bXhDnl+fPalMsHpFXh 2gF0gWU73f07Ly4ce8NIKV9kVhWXuHezDkRbyyK4O9HNqaapWkng5Kxi7jOeDz2fPwBS lHMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=I4KqsMp36I03GiiWYCYUVxJkNmQU7s2ZKOwOHwD3OYg=; b=ntrCS7z3mw3oPAqW1ckQ5gwocLB5hnWFAfDXOhR2vh/OrHJ5mIYTAO0ZVJfiX5CR51 h6xjIKFwkv92wa3obP6vnOvSuMgTvRUMfjFuBdU3kZaI7TkZqhPtvkhEuXrUGhzgMrGF cGg+5nOdzflqf2ZUAnzydwM+NDNlzxIjIVg2wn1Oc9iy4zdAWkgBF4Y0VtBkMZofv6qM bmQKsAWUWYXilLaqmR5UQ44EB0SQTK+fPoKlG4abrie6WW0K2z+OZ2+GDz7+uuSRm/EW xY9GUH9HMySAP+Cpbqb6Ofld7mrOplhTRYbYeRB8wLvUFQhkz7iNugqkOBZefb0X9oL4 Afag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c28-20020a50d65c000000b0045184540977si1072288edj.203.2022.09.20.04.11.01; Tue, 20 Sep 2022 04:11:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbiITKzv (ORCPT + 99 others); Tue, 20 Sep 2022 06:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbiITKzr (ORCPT ); Tue, 20 Sep 2022 06:55:47 -0400 Received: from outbound-smtp60.blacknight.com (outbound-smtp60.blacknight.com [46.22.136.244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E35B6AA25 for ; Tue, 20 Sep 2022 03:55:46 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp60.blacknight.com (Postfix) with ESMTPS id 27311FA881 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: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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