Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp142736ybj; Mon, 4 May 2020 17:55:36 -0700 (PDT) X-Google-Smtp-Source: APiQypLp2nOWq1IJMNQkSOAqUa9aBlYLdlUwawvjHTo+vL4tyjwTSuWq4xUgtI2SL9M7t+bf73la X-Received: by 2002:aa7:c40c:: with SMTP id j12mr551438edq.169.1588640136541; Mon, 04 May 2020 17:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588640136; cv=none; d=google.com; s=arc-20160816; b=uYPLHFSbji9VOYS+Jk97pU4KD/9QwloRcMqxr0kZfeohkomGSFWZZ7r3LpNpk+yC16 oeHOOs6hA0vaanuBszGHvyzuTh6XuzteyxQebDO2nHqP3vvM2skt89OWc5yvuYnrjtnX bu79ABrE/5COICMGBBHwNkQTkPEQUoc2SxnCqMgthgepjbcYJZmPropbOsTHBX1UMMa6 vWCdJtxiaFx+IfMV7FyshjmKQJOLhx9F2vB+IqRKGR1q2RnfDFBRv/QKnbbTM7znRwpc HXbMK6vxvySTyGXn3rMoRloD87MuOOzJ3AE8iXxAPBAqultWa8bLfj7uHroA9o1ZUrpS fNjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b3hPsJgnAq/dGfbpEbMlQqeRtWLtkJ/rfPDyw2Kx044=; b=IQkFYispA6mYF6Pl/n8fCB5Vb1g41s2SAynmYBPBjrQFcFuEDMvNVKYn+9URnx9iXG BUpyFg1lzy4ic9lpdqTmwgWHimpyxXgLgxfajoP8Ng7KlqkqJv8Qy5DGfvi1muT7XdK3 U2ScQfpuHSTtFWsbxrXT/ho5FVlzXY6ekNWttrVEGSxu57h8AaE+0jnF6zqVF32YOlO+ GMBNXIUFDriyRWR5lDTI33+kTWOBxRLUa/zN6I0u/B6JX0a7M0Iab3hcDi8ok6OdpdQ6 O2DyYnHTTzMct6Z5FW3AqdDZnUJymgT/+CmBfjJtb2I90kU5WDsRg+9ZU3EK+Z4wUHWH anCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=VNmjKBsk; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l23si140535ejc.135.2020.05.04.17.55.05; Mon, 04 May 2020 17:55:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=VNmjKBsk; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbgEEAzD (ORCPT + 99 others); Mon, 4 May 2020 20:55:03 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:55038 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbgEEAzC (ORCPT ); Mon, 4 May 2020 20:55:02 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0450nBAw033812; Tue, 5 May 2020 00:54:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=b3hPsJgnAq/dGfbpEbMlQqeRtWLtkJ/rfPDyw2Kx044=; b=VNmjKBskPOyZS197EmCQoi9ZiqIP06MS+SawxA9c3nHNfIvLXhhdrxqFyezuH6cEMFWU mPBV25shFRDsnHQMLyib/s1z7f6rPTjH2thwc4QUn+mUf6axExVTuX/afF42wvquiZ0b dxp7tOuXFQFc0j5gYOtHOGvKUHpe/h+JLBjJVtJUqn0LTAVMG7nyP1saa/UUZHPJyemd DYOvxf+AdvztjhEMfYbcqOdKsy2me3SyAgD0S50D3BfwUJ6WABhXDe16/rvpTWwWkN5q wRdJZQ50aqgW/OmgkaqhXFSIBn9y8DNGKMdnJTFUY8Cp7L2ZLQAMs4ysE+QtFsdLARV7 Ag== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 30s0tma05p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 May 2020 00:54:19 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0450kWUb096333; Tue, 5 May 2020 00:54:19 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 30sjjx9k42-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 May 2020 00:54:19 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0450sBVI006589; Tue, 5 May 2020 00:54:11 GMT Received: from ca-dmjordan1.us.oracle.com (/10.211.9.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 May 2020 17:54:11 -0700 Date: Mon, 4 May 2020 20:54:33 -0400 From: Daniel Jordan To: Alexander Duyck Cc: Daniel Jordan , Alexander Duyck , Andrew Morton , Herbert Xu , Steffen Klassert , Alex Williamson , Dan Williams , Dave Hansen , David Hildenbrand , Jason Gunthorpe , Jonathan Corbet , Josh Triplett , Kirill Tkhai , Michal Hocko , Pavel Machek , Pavel Tatashin , Peter Zijlstra , Randy Dunlap , Shile Zhang , Tejun Heo , Zi Yan , linux-crypto@vger.kernel.org, linux-mm , LKML Subject: Re: [PATCH 5/7] mm: move zone iterator outside of deferred_init_maxorder() Message-ID: <20200505005432.bohmaa6zeffhdkgn@ca-dmjordan1.us.oracle.com> References: <20200430201125.532129-1-daniel.m.jordan@oracle.com> <20200430201125.532129-6-daniel.m.jordan@oracle.com> <20200501024539.tnjuybydwe3r4u2x@ca-dmjordan1.us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9611 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005050003 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9611 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 clxscore=1015 bulkscore=0 mlxlogscore=999 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005050003 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, May 04, 2020 at 03:10:46PM -0700, Alexander Duyck wrote: > So we cannot stop in the middle of a max order block. That shouldn't > be possible as part of the issue is that the buddy allocator will > attempt to access the buddy for the page which could cause issues if > it tries to merge the page with one that is not initialized. So if > your code supports that then it is definitely broken. That was one of > the reasons for all of the variable weirdness in > deferred_init_maxorder. I was going through and making certain that > while we were initializing the range we were freeing the pages in > MAX_ORDER aligned blocks and skipping over whatever reserved blocks > were there. Basically it was handling the case where a single > MAX_ORDER block could span multiple ranges. > > On x86 this was all pretty straightforward and I don't believe we > needed the code, but I seem to recall there were some other > architectures that had more complex memory layouts at the time and > that was one of the reasons why I had to be careful to wait until I > had processed the full MAX_ORDER block before I could start freeing > the pages, otherwise it would start triggering memory corruptions. Yes, thanks, I missed the case where deferred_grow_zone could stop mid-max-order-block. Maybe it's better to leave deferred_init_maxorder alone and adapt the multithreading to the existing implementation. That'd mean dealing with the pesky opaque index somehow, so deferred_init_mem_pfn_range_in_zone() could be generalized to find it in the thread function based on the start/end range, or it could be maintained as part of the range that padata passes to the thread function. Or, keep this patch but make sure deferred_grow_zone stops on a max-order-aligned boundary.