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 BF39AC6FD1B for ; Tue, 7 Mar 2023 16:16:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5AD8A280001; Tue, 7 Mar 2023 11:16:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 55D526B0073; Tue, 7 Mar 2023 11:16:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 425A0280001; Tue, 7 Mar 2023 11:16:57 -0500 (EST) 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 30C816B0071 for ; Tue, 7 Mar 2023 11:16:57 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 04DE1AB398 for ; Tue, 7 Mar 2023 16:16:56 +0000 (UTC) X-FDA: 80542606074.18.13A614E Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf06.hostedemail.com (Postfix) with ESMTP id 812A1180005 for ; Tue, 7 Mar 2023 16:16:53 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hhzoLo9m; spf=pass (imf06.hostedemail.com: domain of zhangpeng.00@bytedance.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=zhangpeng.00@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678205814; a=rsa-sha256; cv=none; b=rdnV6XPJkY/xixxgQIcPfBL4XkEL0DcJBcp/cyA6nCTT9csOjwCPFRHtcJUHY0MQcO+89R TlX0SvgnaxW0hRVTSK2eSPzAikd4iKF0/YnNIzOmmw/owpevk42QoqPRy0CRxOR+CPLK+I 7MRk1Jow2PUPJ7gynUwE8gOmho1aY+M= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hhzoLo9m; spf=pass (imf06.hostedemail.com: domain of zhangpeng.00@bytedance.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=zhangpeng.00@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678205814; 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=UYrq8v4HuBX2RB3d/VYQuTqaXQLxDy94/DGyKGTa8GE=; b=msGLByAmsv0gx2DKnyqLKi79qbbqXxg/kAc/5MJsm47A9O0UiYefN6LKo26o0hPACldT2t ItJ3qWDL5XncRv5JTbAcA2UT89liaBU+9YwS8j8J//zZCAdI1ABuhwk2IPHYUSU8kfpII4 xZttKbbwASK1lhknEqDx1VjaJbxoqQU= Received: by mail-pj1-f44.google.com with SMTP id x34so13773248pjj.0 for ; Tue, 07 Mar 2023 08:16:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1678205812; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=UYrq8v4HuBX2RB3d/VYQuTqaXQLxDy94/DGyKGTa8GE=; b=hhzoLo9mKt/chtZRRSOWW58mZp/EbLNymdzmTurgTLcgtj8rNx6VnB/zZIJiN5dEMU eVe5J6srcOE82KYyn5ItH6i9pMruynIPB389vTFujaSn/WVOs0lKDCeeyD+wkJS5kmr9 vRbRLHKU1Jo6wjY7Af+eOUM374qWjJrS6eTxxIL3WGPR9d7y47OHFyNzOdNF5ND96sdP XywFbkdI+e0GX6cdCgibnT1u4bIUjU256+5wLjw1VjSrShhAQAX69wZdErCstme3BwZe ZjJPbdMR3xt2o0B7+zoNSUs1nlpJj5QYPHkos75VEGPw3Hmk75Dm0DaoigmV72xRC4OF 5jkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678205812; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=UYrq8v4HuBX2RB3d/VYQuTqaXQLxDy94/DGyKGTa8GE=; b=6qoaQYaa9yS3OwGfxbu625KkMKvHcOta96HDnNGFZ1Zhm0GO/Ho5w6xnj/I1xxwtmr gTzms0cdF1A8tEn9ovBV7sqTPOqHYN86WTdgb1MtPfNYOveARke90Jejjeoo9IO0+0JP FmWd8IZ+mhapi5eTcML/Bj3CDM7uCQvlXTd3/LwfapVuDMujl9kleSz9uKVn1hJfKuxd jUbjvq58TzVPB5Py3R3a3pt8k+i4GdzCeoEl9rLapdTYLiTXjsLMRl1376Gs0RmG77WH 7JrYTp+1Ds3ccJRMO3uE8+wsWZeV00Bk2b76rvNJczMNVhGNavp9DCeJnFEKole9falv /zcQ== X-Gm-Message-State: AO0yUKW0Q2L9MpAiv+JtybXK/rj7z0iw3rzfFNH9VlKQyZjvG22HnNrO Gc+E6ZqCRT6nhNzKaty8zde9+A== X-Google-Smtp-Source: AK7set88BIwUJLFdpOXlbPGslKaEFH1+u9BuN0cxiLp2l426wfCtLQ01n+NArA7B7dU5e3lv3y6Fyw== X-Received: by 2002:a17:90b:3ec9:b0:230:7c78:6a7 with SMTP id rm9-20020a17090b3ec900b002307c7806a7mr15672363pjb.28.1678205812067; Tue, 07 Mar 2023 08:16:52 -0800 (PST) Received: from [10.200.8.102] ([139.177.225.254]) by smtp.gmail.com with ESMTPSA id fv24-20020a17090b0e9800b002340f58e19bsm7568391pjb.45.2023.03.07.08.16.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Mar 2023 08:16:51 -0800 (PST) Message-ID: Date: Wed, 8 Mar 2023 00:16:45 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 1/2] maple_tree: Fix mas_skip_node() end slot detection To: Snild Dolkow , Peng Zhang , "Liam R. Howlett" Cc: Stable@vger.kernel.org, maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton References: <20230303021540.1056603-1-Liam.Howlett@oracle.com> <73971153-b46e-0332-aa4a-0dbe0a59fd22@sony.com> From: Peng Zhang In-Reply-To: <73971153-b46e-0332-aa4a-0dbe0a59fd22@sony.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Queue-Id: 812A1180005 X-Rspamd-Server: rspam01 X-Stat-Signature: nt191exbputfe8zekn5ciusc35fnty9z X-HE-Tag: 1678205813-111183 X-HE-Meta: U2FsdGVkX19ZTkjJ2JBFwE4hviuDp2VZQ/SJ1rLqxMV4XJrTrnZ1RtPCk/Hvsididy+JglPRzHp6ZKW2a3ReZnGuyNP45dU5t9X0C5Y3Em+XYSXNH/NhoTCSa2CLA6vLeaqY+OtSAkTpN2ot1FB9x7wCyQBCK1NxHA9eT+ymtwmoQteinOvCYBKntf5Kf1LHB98Wxclv85Kg7X5tRryEOw4jtdyBqH1JRZP/+jR5DPE6O8stUqKIa+GvbGQ6FvWjCfYOU7VgiRR/2LBvbN4+uYcPKMl7JWMA03s+JVx6hAqHYV/y+myHiXCU6zmlLPEjyPOzWy1jJh3nMHbLjFYGe4Wc6LcPYkWrpc0rtHsiv2HcqvAXqTICuB3k7U2dU4Ns6LBQ9ZiVIFS9J2N8072QoJg7pzgHkHR85ySQPp1Ul6U97DRwONBMoxgIUdUD1XcSGMpDAVKx+wI/HxfyC7t9uuHPfp4BS4y0ujKVs0wfsIEjNjBvaFDPjxWAzLvxsw0bq3EDRPHYG3jLc6eOaE0yGCmlfiGJFUFv87qNcflXQ/bIQ3zKj74jKOcXuJ2o13SOyxqxi5Tsk31NHuRRfsbKrUHNIVe7hREutWPHK5t3w5RiPBlySgLTKGZyOg3FI2vUziIqiWJYsOIL6J9DWb2VmoIdjionWYZE6jguUy2jLwTtuZGm0sn3GgNVEfwcnMRn1OAZF0vNOyShaMpkI0e23xRbwarY/690anzflKRgbcKeEQHmkPZb34sIflmoC197GJFIKukJ9x2YvJ00hwTEqqWugChb7bt/lqto59uvvq+xlE+ImOT275/jUT7hFAjDG1wXvCusTpaUNW22t9kCLFUeyl51rwzUawMJsnxfMYNVoxdalWePcr9PZtk6wXGJEcehVCk/L9oqRBWz8e9EXyV6FUnxkqEBtooQ0c7Q/SHkuliJu+6zZY4JiuuyxntHcK4704AsDAfKj5pYmb/ 7H6ckvc0 nvcQSslQSB3iZbt3AzZwkulU5SDvP+3Cl9GkIJyWgxbCPBJ8VRUF7obLtAmHroZ7ObIOUbyuUgTfnPuFlRkJ72F+W1u/PJmFG90bsGnz5ypikO7AocgwpquZaArLMq1+PBW1SEN+OYh2cQDD/oOn5fPrfQ94pi8T6L1KLU4nVjZoNQ6sQ3MGZ1oJQyNMG2N+d78NiTCKQGt+/9CWyIhnz2jfk6AxbmxdCKuy7HVNEpqUk+07k9eWde2SRdrKGVqOFKjE8ly0HqG0YXdWx2aVyhTbEoAgTKBwx6Porl89pJlNEpVAKJeNUDYwqylU8EGzvhrFf4LXTr4/wIJmj9+FttKkyDpFXZRTO/XPKVxFtYQ/+nLd20re0EgNnrQza59LhXhFAe5CcEkt3U6rU1vbpFVBTSXLF1KCs/52stLXBcV7Pobs= 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: Hi, Snild, 在 2023/3/7 22:30, Snild Dolkow 写道: > On 2023-03-07 14:05, Peng Zhang wrote: >> Hi, Liam, >>> -    } while (slot > slot_count); >>> +    } while (mas->offset >= mas_data_end(mas)); >>> -    mas->offset = ++slot; >>> +    mt = mte_node_type(mas->node); >>>       pivots = ma_pivots(mas_mn(mas), mt); >>> -    if (slot > 0) >>> -        mas->min = pivots[slot - 1] + 1; >>> - >>> -    if (slot <= slot_count) >>> -        mas->max = pivots[slot]; >>> +    mas->min = pivots[mas->offset] + 1; >>> +    mas->offset++; >>> +    if (mas->offset < mt_slots[mt]) >>> +        mas->max = pivots[mas->offset]; >> There is a bug here, the assignment of mas->min and mas->max is wrong. >> The assignment will make them represent the range of a child node, >> but it should represent the range of the current node. After >> mas_ascend() returns, mas-min and mas->max already represent the >> range of the current node, so we should delete these assignments of >> mas->min and mas->max. > > > Thanks for your suggestion, Peng. Applying it literally by removing > only the min/max assignments: > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > index 6fc1ad42b409..9b6e581cf83f 100644 > --- a/lib/maple_tree.c > +++ b/lib/maple_tree.c > @@ -5118,10 +5118,7 @@ static inline bool mas_skip_node > >         mt = mte_node_type(mas->node); >         pivots = ma_pivots(mas_mn(mas), mt); > -       mas->min = pivots[mas->offset] + 1; >         mas->offset++; > -       if (mas->offset < mt_slots[mt]) > -               mas->max = pivots[mas->offset]; > >         return true; >  } > > > This allowed my test to pass 100/100 runs. Still in qemu with the test > as init, so not really stressed in any way except that specific usecase. > > //Snild Thanks for the test, I'm happy if it happens to fix your problem. So a patch was made. This patch needs to be applied after Liam's patch. Sincerely yours, Peng.