From patchwork Fri Oct 25 03:18:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13849981 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 102C2D116E0 for ; Fri, 25 Oct 2024 03:19:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EE386B009F; Thu, 24 Oct 2024 23:19:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89E366B00A0; Thu, 24 Oct 2024 23:19:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73EA26B00A1; Thu, 24 Oct 2024 23:19:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 557ED6B009F for ; Thu, 24 Oct 2024 23:19:01 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1EFAC1C5042 for ; Fri, 25 Oct 2024 03:18:39 +0000 (UTC) X-FDA: 82710667494.10.694A1C1 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by imf23.hostedemail.com (Postfix) with ESMTP id DD877140017 for ; Fri, 25 Oct 2024 03:18:46 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=EL+VlNfS; spf=pass (imf23.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729826134; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=OGU6pIYZrdc0vHiY65By/hX0VQKvIsxve98Cje1t6po=; b=ZjSEerTTiFCT49B+7eyuQn1Ss72OdR5KohAIh3xTiMeeO628M+XgKsRsyREe9f4fuCMKMg QuP+vsJCNg/biOIGkaI5ikIzOfEcfG0of72DKmKZgasiC9X4noxyC2ErNMR+j5BsfJI7oO n9e/ZwJBrQrcKjnFTh3/MUULMtf1EYE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=EL+VlNfS; spf=pass (imf23.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729826134; a=rsa-sha256; cv=none; b=fbfi5pnA0dnimp7eWZNeXT0gR1NADr89JAr8g5wFlZxDOawNryBfwalZPhJKNJoCbHN8p9 yx/ytiAXWb7ayr2wvxT+iKRN+Badb9vR2dr9KCs8/T6go7A/LFCbvJE57zawKO5rG8F99N m5YB2Un4CktE2yenSLlw8nuBkNssZys= Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5cbb0900c86so289273a12.0 for ; Thu, 24 Oct 2024 20:18:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729826338; x=1730431138; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=OGU6pIYZrdc0vHiY65By/hX0VQKvIsxve98Cje1t6po=; b=EL+VlNfS4qWygP+JO/lxoTDywHpHi9PRk7WOz/vM0aVusxaIwfvhZ4yPKcRNoP3ltW CpIHS95Uwt2vpll+cGgnU4Qp3GF1qnf9g7nzpUFGq94zgxM41SNorofCcKydV8AtCZfc EQz6tmf1jKMlPfC1qb0AQI1TKbdb7kFgg+mBrj0E9hHppk+nnE185HMPOzDmsRgmWGwy mU2l5FmEBD3l48kjA/0VFS+egW/7Y1LGr7GfA+5xmR6W0W/am2xCbFsxFbeHDJGiELMM VAaYtwafQHF1bQmiZEG79tfrMoEL3kjiqfdiPvHwlPRjvXCsJhMAG4WzMoQX2cN8sW4c YyLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729826338; x=1730431138; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OGU6pIYZrdc0vHiY65By/hX0VQKvIsxve98Cje1t6po=; b=YWvmLgU4GLv+WQGZo2B4Il+09vrXMeuzO+q1uAWNLkC+7CNREvo9894sAu5zeSrmDq 5q+aF50jgBDny/sF0p1vC++xi1T0lZUQ+86ECuw5DJjXAU6KcOwTzpBst56uZmppOw/I Y9uSe0+/Q4P2lxJqAHEiBkWfELbeMD5Id0RCAGnEVfzLwa8Nwg+EtxW0jpEje6n+D2nH 1oZwUbPbNNrWOeBMbaefJaIT60yKN9SHZyRG08TW25nzZoPJaQjM6gP8ShoVKjwYviwv PweyGXMeFx+YSF6MVBLWHWqbKFxL3W3dxOGEGeEaTzPR5YCju81iL8jWgrAAN0e7ujCk 4ViA== X-Gm-Message-State: AOJu0Yxc/9Gg02QD7uerVLYc1Vh92Xue4ayxMR3Bn8idE3lY/6eTRZdE 63KAo2G1TMP6jO7Q+lL5hw6aR4n0bcMJM8fE+nmlJ3dCzVicKone X-Google-Smtp-Source: AGHT+IGq1+GU2VCzi5fAA/YyBhEg00adRtHdx+m30uzfI+Abnp8En4IX9hN3n2wmJCBo/W04ApRPXw== X-Received: by 2002:a17:907:6095:b0:a99:f7df:b20a with SMTP id a640c23a62f3a-a9ad286d0e1mr353618766b.62.1729826337712; Thu, 24 Oct 2024 20:18:57 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dfbde87sm17262566b.23.2024.10.24.20.18.54 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2024 20:18:56 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com, lorenzo.stoakes@oracle.com, vbabka@suse.cz, jannh@google.com Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH 2/3] tools: test vmi.index would be restored on merge failure Date: Fri, 25 Oct 2024 03:18:46 +0000 Message-Id: <20241025031847.6274-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241025031847.6274-1-richard.weiyang@gmail.com> References: <20241025031847.6274-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: DD877140017 X-Stat-Signature: 3xh9c3cri6rkf1tggpb17fpxh6r5k17k X-Rspam-User: X-HE-Tag: 1729826326-209410 X-HE-Meta: U2FsdGVkX1+6mpn6vffYNfQWmm0vxbUDpBN+VoORqoOVMYRY7+x7QOXBSU6kq44oXRF3bss13aEs3875pHsYiUSMXPg30EnT4ss1n3r/qRkSqrxOl2ZO79y00hCyG5DsRkzYS7otROG3ywRJcdYW1Q4OULo6wVMjDoLaiPl21NdU4PDL6J4XZvs0Dh4yRk9lQg2xD1U3iDdobqbpBilR6w4KOhj6rZdLMHfs+LJBPO8v4NF6o1iwB2jEYCmj7NGtqzcAsVbc1EzigvopUbWRUG2PGesYRwGdQCF5S67cgiiBnFyA/M1kLx7Tf8m4sFIVET3m/mk5GesbzHQhMhkRfsxbJv1vkdOphLpHo4TGyo1BdQVIbWXe+PfU3XP9z1iUby9tym3MYADbJ/yWshlIchb6xLXS9NHs6AX4i4QPim/f5g2b1r+9ZcXXZlOgmniFLmMJ0DSkMNCjZ16YtR8cG86zMyMQBVe6KV0jBN8nawBQOpDtFFZaem1cuIeLLgqjcJm5n4QzEc0tDhCkabDybpv0JVcCFO0b0eFfjD6unQUZi6B3auwB9gYZ2F+TkZfXp0lVaplFQuYJEToKLTaJXTrX8G+rZL/NuOnvgNqkjWjNW484bESfHIGKJPVH3j7JHFc2RUYspYwq4R7/ZAHVtI0T0NuqPZZipDyrwEp2QOIdNpyWOxU/gzNYR7P82xWmCaT2+SizMnSeXak+VTHyFYUGLmUreogZij7/QlYPbcSh/U1Y293keOhpvxawYJjkOp6OfJh4LqcFXDJvHwV9bG5FoL6xOhJ/103EV2NXugHSJAYX1SBFl3vNmidkD0Z5c0R5LgZg6KSRnHgBXKKq2wd479igQP5Dzn0vEZJvUQfg842uAMVyKG6jmhYWsSony45zj4ia0FuQu8EHqh1HYKxpxEmE/VJPXhOuYOV9Y3v4TkM49fSFg3KCY+HiM1csuUFp0elvsqLRouvh6TL exXXwAit j8AaFT5LxKhCZlAz9R2EX/Ksy4EKnHsiMXKdaSnixC+qSyYzZLIx6n6vlY4xXxntyaKzx/t3XuP6PKtDQCAYwENeUhOVymENMyYSPMqy0KJwEfr9eAUa7OdmEwL02yanOkeXizopz3dcFaYfEMZZExc+TB4X0X8lRhj9bmAkUX5CqH3q40pZX+6ZFlUe4RATMguVgUYtucegyT6ot73Mkbuu+f5Fq8QqDkJOZSZlshMeLOQb/vTB5ijpNDlC3CTMniEsUvELt9wohV+wCFvFmbroqqmJA9eCgVVqjVVAQG62QKjWE1iRatgtJZhegn4B+ysek3V2W90x+TZMGyAKIivkZErCReaSQ4L4/FLaGrBrz+SIcEOj/HF+cEucnXNf97TLeQZ26Dg+gwXtf+tMEcCxg4HT78UohKuVR8/fEvwHTpyhHR9zsLKX51d4xg8dffhmAJ6FqQDHRuy/4T6c/qP25zA== 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: List-Subscribe: List-Unsubscribe: Add an assertion on restoring the correct index on failure. Signed-off-by: Wei Yang CC: Lorenzo Stoakes --- tools/testing/vma/vma.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c index c53f220eb6cc..46e8989a90ae 100644 --- a/tools/testing/vma/vma.c +++ b/tools/testing/vma/vma.c @@ -243,6 +243,12 @@ static bool test_simple_merge(void) ASSERT_FALSE(vma_link(&mm, vma_left)); ASSERT_FALSE(vma_link(&mm, vma_right)); + fail_prealloc = true; + vma = merge_new(&vmg); + ASSERT_EQ(vma, NULL); + ASSERT_EQ(vmi.mas.index, 0x1000); + + fail_prealloc = false; vma = merge_new(&vmg); ASSERT_NE(vma, NULL);