From patchwork Fri Oct 25 03:18:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13849980 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 EFA81D116E0 for ; Fri, 25 Oct 2024 03:18:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8524D6B009D; Thu, 24 Oct 2024 23:18:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 802056B009E; Thu, 24 Oct 2024 23:18:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C90C6B009F; Thu, 24 Oct 2024 23:18:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 450F46B009D for ; Thu, 24 Oct 2024 23:18:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 25314ABBF3 for ; Fri, 25 Oct 2024 03:18:20 +0000 (UTC) X-FDA: 82710666906.09.4EB01B6 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by imf10.hostedemail.com (Postfix) with ESMTP id CB905C0013 for ; Fri, 25 Oct 2024 03:18:47 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=G5jme+EZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729826296; a=rsa-sha256; cv=none; b=qJomu+maEYbBdgIKyYtWF5+b+FEMpgSH2FZsTuSr4A0SMpqLnKNq0Z5oA2jBJLbVvqV7XL Ft3yNTdkUWh22NdOFCvHUydgN3yrhmaRG+E6XvDyFZfaQ0MElUsoyVcAmWukBdVoLL0vA3 Ynw9Sy9HFnvp7eAS/MF2jgyNgKnH8rI= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=G5jme+EZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729826296; 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=+ayWe0cd4kSx4dE5xBlMiTQYZFm4Rg9mYHFy0YuaQWM=; b=giqz9RWeoiSnMbcEJGs7nwvsNM7hz4Xi96TMIodFE71MV+V4CutkvoyEufyuOynrJME1lG wBX9BM70hef3bzz/E70XlwwjmlmJy+YFFD5IaSyClnrYj/AjqsYsWaDtIb+HB8ZuzykQCR LVlHvq/WdNaDAxB7l9Q5ziH7iMD14SU= Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5cb6ca2a776so2007467a12.0 for ; Thu, 24 Oct 2024 20:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729826335; x=1730431135; 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=+ayWe0cd4kSx4dE5xBlMiTQYZFm4Rg9mYHFy0YuaQWM=; b=G5jme+EZVeEf7fs5kuDXe4xyoD7a8gPT4kRps+mctdUKPmApTkgaPc4okjEZ/xgc7l ABgZcpzrKiBtYQ8hJN4aFzOjba5xgd2TcUQ0HE7TFU3Ylk2syEqkoSLHgFrrTdMpeUUp YnaU5OIEPqH4XgJtvGphkPbV2ynY+f/KDL+7vEyc+kkjHPEzPkaua2fnteOgbaxkr1Da FJk+rbQP1EiZGvtVWGc8wxLNbs1mW1ABT/6CuDZtAvMAu1fhehiFrDnq6M8Qc+a9sFCN 6hkeE2rJ8zKE1SOkXyJdUYg8yRFDfTkfN7d446B6W7j7bWoaVsWhMx98v6ZmspA+BNwN Y39w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729826335; x=1730431135; 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=+ayWe0cd4kSx4dE5xBlMiTQYZFm4Rg9mYHFy0YuaQWM=; b=Ht3nG82QaW44hx0fPKse+q+82L1lPCU4q3S0Nub8R4SRGY5uNjlOjzNAoCYR5PCO5t C6mRSup/ypoCR1IaeKBASKFfCXS710wMIBfiaKVcxEHiw80RXnekKxI41BqkSP9Cf/8C SsNVC9KFROD/iBaogbLkKnP2SBJM54P0l11JzSOpjOjLnN25V21GResS6WiKphLVdYPl pc8JKQvUU0W9OJUakH38mlsD7lAOMDXw4QSJNNiJ3oLWklVYYYoNfugDdgKp7vNaZ+CI BuGXNBg9W6qae7WjiOPd9dzI9ABM8A9Ni8ua2UP32uKbG6ssdQ8j8vufwMSfiMtmswM2 5uTA== X-Gm-Message-State: AOJu0Yxwjr5tj+LlbAQagrtB/sV+jFjbalb8BKpBEBAt7+AmsguLBGA8 CogQDBvQzdA02fPJzRDNydR3kNOgTfISiqm4u7elhoZKUrH4u3k8 X-Google-Smtp-Source: AGHT+IHT9OzlHQFrtCFBszAVWcZDz49oMuYXM4h8zdUdL88cXhUcghR/ecDN3T1s347BQJgivs5CCg== X-Received: by 2002:a05:6402:51c8:b0:5c2:439d:90d4 with SMTP id 4fb4d7f45d1cf-5cb8b1a1084mr5808296a12.30.1729826334592; Thu, 24 Oct 2024 20:18:54 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cbb62c3da7sm136569a12.55.2024.10.24.20.18.52 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2024 20:18:53 -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 1/3] mm/vma: miss to restore vmi.index on expansion failure Date: Fri, 25 Oct 2024 03:18:45 +0000 Message-Id: <20241025031847.6274-2-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-Rspam-User: X-Stat-Signature: g1qk6soffzkgbisw4sjbfs1i4qkq5yi8 X-Rspamd-Queue-Id: CB905C0013 X-Rspamd-Server: rspam02 X-HE-Tag: 1729826327-66622 X-HE-Meta: U2FsdGVkX18RYmbJin+jdPDtZKcpg7ghO6qXmGAJ+Zd4bz1hTu3uBp/ULEnL9gQ+Xj1IozWfwbenPkpz0NBQEzbkjC0m1EkRH5mqPxPHIIrrquSxYfM8pL5sok0/BAXBk4JjRrBQPyYNwBM3Sw1/z2wuM+18iFdN2nRIfuyA7Yk5VipJBf3yc4mweEEW3GGUU3kFLKKHCPBOoLRAnd15LNJejcrh6MjIU4yZln+3VyOVKbctSNadWqYXy60T4bDPHDsV1Mhs+iWEL1vsWfXZ1speG2/CSBE1l2dx3NFATFMBrJqDk2xDMpgQXVEeqnqcW/qvuSnMzpZ+zRlwFght55GLmyvc2L73Wrqq+yh+8X5njImBvB7TJSM3y1P585Xx0vwPZEtK1cISKyBRCKT3YVoAnl+kzhUjfXNSCCQgkdMQa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ender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On expansion failure, we try to restore vmg state, but we missed to restore vmi.index. The reason is we have reset vmg->vma before checking. So let's put the operation before reset vmg->vma. Also we don't need to do the restore if there is no mergeable adjacent VMA. Let's take it out to skip the unnecessary operations. Signed-off-by: Wei Yang CC: Lorenzo Stoakes --- mm/vma.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mm/vma.c b/mm/vma.c index fb4f1863f88e..c94d953d453c 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -954,23 +954,27 @@ struct vm_area_struct *vma_merge_new_range(struct vma_merge_struct *vmg) vma_prev(vmg->vmi); /* Equivalent to going to the previous range */ } + /* No mergeable adjacent VMA, return */ + if (!vmg->vma) + return NULL; + /* * Now try to expand adjacent VMA(s). This takes care of removing the * following VMA if we have VMAs on both sides. */ - if (vmg->vma && !vma_expand(vmg)) { + if (!vma_expand(vmg)) { khugepaged_enter_vma(vmg->vma, vmg->flags); vmg->state = VMA_MERGE_SUCCESS; return vmg->vma; } /* If expansion failed, reset state. Allows us to retry merge later. */ + if (vmg->vma == prev) + vma_iter_set(vmg->vmi, start); vmg->vma = NULL; vmg->start = start; vmg->end = end; vmg->pgoff = pgoff; - if (vmg->vma == prev) - vma_iter_set(vmg->vmi, start); return NULL; } 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); From patchwork Fri Oct 25 03:18:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13849982 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 214BDD116E2 for ; Fri, 25 Oct 2024 03:19:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4DD46B00A1; Thu, 24 Oct 2024 23:19:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FD966B00A2; Thu, 24 Oct 2024 23:19:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 878996B00A3; Thu, 24 Oct 2024 23:19:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 685DE6B00A1 for ; Thu, 24 Oct 2024 23:19:04 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 53BC7160388 for ; Fri, 25 Oct 2024 03:18:42 +0000 (UTC) X-FDA: 82710667620.30.FEA81B6 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by imf27.hostedemail.com (Postfix) with ESMTP id 00AAB4000B for ; Fri, 25 Oct 2024 03:18:42 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="KQjv2/B5"; spf=pass (imf27.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.54 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=1729826290; 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=+KF0a3QTIH8Nupcu9mgsGyFvPNKwx21Ojy0W9OAQxpE=; b=6dEu1lUkR9FOSL4tpw8Rp0FfZCanY/0DQ5b8k6Fsja+hR3W80IFKsZVBUx2VSXTi0Igs3a uK1YrUjfUVdu1FxeZBw7QAeR1E2Y8Ns5rhSoZj84ho0asHWP2AuPBasUcKqGmBcMbVTfc6 WV3CyQ0vRX6lAjNDVznnsJ9PKyf54Xs= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="KQjv2/B5"; spf=pass (imf27.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.54 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=1729826290; a=rsa-sha256; cv=none; b=Wj17PKPoLcC2yqkv5nIXiQz2k9yLnMG7EgtfyprrITWuRmgsjf0klLtPpzCBjIwjac0zUC YZ1molCenm2yXbuxYRh5fGhyjRUKzQh5vVETL+XHnZEfrDl8L0k1sVe0R9Fq/KnXD6Jc6x 1YVOoCNJnp0hOX0K0jQ1RB++Fp9BfSk= Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5cbb0900c86so289324a12.0 for ; Thu, 24 Oct 2024 20:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729826341; x=1730431141; 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=+KF0a3QTIH8Nupcu9mgsGyFvPNKwx21Ojy0W9OAQxpE=; b=KQjv2/B5wkQjFpNDKCC0HEmyBLFbsZU+PLsnWA12Dc7hcsx2XOZ4xUXFaZ0n7lGnLD xzrJ33UdskCPKgggFLsevyOhM5cDcJfU8/pRhMx4mE7XjoqfYod/7g+e9NJG+ttZOkx2 2nONwlYvJWOil2oOo2/88Zk2FrBOKHBTriRGbB9bEcsOlCfyQtoFRqKtSsIVuvlT0uCi L0nVTtQO1q2KmH4YfhY5hhz4k3hDC9fyL5adJKpG4HScFVa0M6AuWoZ5i7uRanZb99OL 47GkZBnKYOChjttslfd6RaTvsrjZULrF3Lj1Q9zmDFBPF3KH1V81oVY4UjZ/8onEYMLc sF1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729826341; x=1730431141; 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=+KF0a3QTIH8Nupcu9mgsGyFvPNKwx21Ojy0W9OAQxpE=; b=btUE5Rx9/r9u5fkkEmcv8TXM2COPbYzxCgTlB+fd1Kjobe1T0XcqB304bw4JWfSGCK kU9on3/wyNHVU9iqiKc+rTTNWj/jci4BBTKNhWPVrGr9sDPx3rueGWRXj/Hp/9ph3K6T sYl9ePdFApe5PgxkEeIeym5ql2F9sI6vegcScGybjdt2Z1H0J8z3xIE/AwSbfn12jdTD sc+CzDB4Vyal/Jk38nEbKZiC19r5FBCzeriurTFV1DHejPHSyeCHESExYibQra3SP2uF iynzvv8xVFE9Hkfi8K+iHCEiXxUaOtjdKaMvRdMBuo2GK4lJ19o4emULHG5tINe5kgDP iuUw== X-Gm-Message-State: AOJu0Ywo5WTiP6Z6HXuhnILN0fIGABgf7VpHlAIX2C5HCy9QI/wEKoz8 3Mm6g2IRpTZQy3N90McrrPaDhZFPiD9pOMAge6V7VVPqOPTbOuhp X-Google-Smtp-Source: AGHT+IEorXw9pXMHPH4U+Zj0YOORCWN39rKpdKaCSdDbE5jR4ktf8XojAPMgqMm5ujVJZ7ByCTFN3w== X-Received: by 2002:a17:907:3f24:b0:a99:5d4c:7177 with SMTP id a640c23a62f3a-a9ad270a06cmr335549766b.6.1729826340833; Thu, 24 Oct 2024 20:19:00 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dec7d69sm17315366b.7.2024.10.24.20.18.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2024 20:18:59 -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 3/3] tools: fix build error on parameter name omitted Date: Fri, 25 Oct 2024 03:18:47 +0000 Message-Id: <20241025031847.6274-4-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-Rspam-User: X-Stat-Signature: i1seb4z6a3y79i5uhbsj5wypq8w6ij7c X-Rspamd-Queue-Id: 00AAB4000B X-Rspamd-Server: rspam11 X-HE-Tag: 1729826322-944135 X-HE-Meta: U2FsdGVkX183ozGwqMYvAR1AUed56DGIMUx4LtYUgx+s6xuSYf5oLvv3mWJb7DGs3CkgUW8+dbnEjw+AnN1azA9gNdgxiVWkg4GKKZhvRRMNs1EqZ3/NXrt8QsI1vPfItTiFLScqhXaIVCPl6ioRheQRPxpkm7aA4fwY0k1SMrCoQ8bRaUEBOOeu6a9EzktQHzlQs9t2O9+KD7+GKrmaKs1H4vEoNugpLWnzisVVdrPl4mZzE7t4lUYx8vbS9tSuRQT5adSleGxztKa0/vQ3CALtagHiCxF8W1FX8Dp3BAU/d4ET0l1akYbSj63iaytTdAim4WR58zsn3BnAUD/gZ7ieK5ZIVraKjh6FK3kCKEcFAaqIl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DB6XOVLzNtzMZoNc89HQjA== 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: On some old version gcc, e.g. 8.2.1, it is treated an error. Just add a name for it. Signed-off-by: Wei Yang CC: Lorenzo Stoakes --- tools/testing/vma/vma.c | 2 +- tools/testing/vma/vma_internal.h | 82 ++++++++++++++++---------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c index 46e8989a90ae..212b14a52bd3 100644 --- a/tools/testing/vma/vma.c +++ b/tools/testing/vma/vma.c @@ -219,7 +219,7 @@ static bool vma_write_started(struct vm_area_struct *vma) } /* Helper function providing a dummy vm_ops->close() method.*/ -static void dummy_close(struct vm_area_struct *) +static void dummy_close(struct vm_area_struct *vma) { } diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h index c5b9da034511..b7aa9369796e 100644 --- a/tools/testing/vma/vma_internal.h +++ b/tools/testing/vma/vma_internal.h @@ -620,11 +620,11 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma) return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; } -static inline void fput(struct file *) +static inline void fput(struct file *f) { } -static inline void mpol_put(struct mempolicy *) +static inline void mpol_put(struct mempolicy *mp) { } @@ -648,15 +648,15 @@ static inline void lru_add_drain(void) { } -static inline void tlb_gather_mmu(struct mmu_gather *, struct mm_struct *) +static inline void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm) { } -static inline void update_hiwater_rss(struct mm_struct *) +static inline void update_hiwater_rss(struct mm_struct *mm) { } -static inline void update_hiwater_vm(struct mm_struct *) +static inline void update_hiwater_vm(struct mm_struct *mm) { } @@ -686,23 +686,23 @@ static inline void free_pgtables(struct mmu_gather *tlb, struct ma_state *mas, (void)mm_wr_locked; } -static inline void mapping_unmap_writable(struct address_space *) +static inline void mapping_unmap_writable(struct address_space *mapping) { } -static inline void flush_dcache_mmap_lock(struct address_space *) +static inline void flush_dcache_mmap_lock(struct address_space *mapping) { } -static inline void tlb_finish_mmu(struct mmu_gather *) +static inline void tlb_finish_mmu(struct mmu_gather *tlb) { } -static inline void get_file(struct file *) +static inline void get_file(struct file *f) { } -static inline int vma_dup_policy(struct vm_area_struct *, struct vm_area_struct *) +static inline int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst) { return 0; } @@ -750,31 +750,31 @@ static inline void vm_acct_memory(long pages) { } -static inline void vma_interval_tree_insert(struct vm_area_struct *, - struct rb_root_cached *) +static inline void vma_interval_tree_insert(struct vm_area_struct *vma, + struct rb_root_cached *root) { } -static inline void vma_interval_tree_remove(struct vm_area_struct *, - struct rb_root_cached *) +static inline void vma_interval_tree_remove(struct vm_area_struct *vma, + struct rb_root_cached *root) { } -static inline void flush_dcache_mmap_unlock(struct address_space *) +static inline void flush_dcache_mmap_unlock(struct address_space *mapping) { } -static inline void anon_vma_interval_tree_insert(struct anon_vma_chain*, - struct rb_root_cached *) +static inline void anon_vma_interval_tree_insert(struct anon_vma_chain *node, + struct rb_root_cached *root) { } -static inline void anon_vma_interval_tree_remove(struct anon_vma_chain*, - struct rb_root_cached *) +static inline void anon_vma_interval_tree_remove(struct anon_vma_chain *node, + struct rb_root_cached *root) { } -static inline void uprobe_mmap(struct vm_area_struct *) +static inline void uprobe_mmap(struct vm_area_struct *vma) { } @@ -786,15 +786,15 @@ static inline void uprobe_munmap(struct vm_area_struct *vma, (void)end; } -static inline void i_mmap_lock_write(struct address_space *) +static inline void i_mmap_lock_write(struct address_space *mapping) { } -static inline void anon_vma_lock_write(struct anon_vma *) +static inline void anon_vma_lock_write(struct anon_vma *anon_vma) { } -static inline void vma_assert_write_locked(struct vm_area_struct *) +static inline void vma_assert_write_locked(struct vm_area_struct *vma) { } @@ -804,16 +804,16 @@ static inline void unlink_anon_vmas(struct vm_area_struct *vma) vma->anon_vma->was_unlinked = true; } -static inline void anon_vma_unlock_write(struct anon_vma *) +static inline void anon_vma_unlock_write(struct anon_vma *anon_vma) { } -static inline void i_mmap_unlock_write(struct address_space *) +static inline void i_mmap_unlock_write(struct address_space *mapping) { } -static inline void anon_vma_merge(struct vm_area_struct *, - struct vm_area_struct *) +static inline void anon_vma_merge(struct vm_area_struct *vma, + struct vm_area_struct *next) { } @@ -830,15 +830,15 @@ static inline int userfaultfd_unmap_prep(struct vm_area_struct *vma, return 0; } -static inline void mmap_write_downgrade(struct mm_struct *) +static inline void mmap_write_downgrade(struct mm_struct *mm) { } -static inline void mmap_read_unlock(struct mm_struct *) +static inline void mmap_read_unlock(struct mm_struct *mm) { } -static inline void mmap_write_unlock(struct mm_struct *) +static inline void mmap_write_unlock(struct mm_struct *mm) { } @@ -862,11 +862,11 @@ static inline void arch_unmap(struct mm_struct *mm, (void)end; } -static inline void mmap_assert_locked(struct mm_struct *) +static inline void mmap_assert_locked(struct mm_struct *mm) { } -static inline bool mpol_equal(struct mempolicy *, struct mempolicy *) +static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b) { return true; } @@ -878,44 +878,44 @@ static inline void khugepaged_enter_vma(struct vm_area_struct *vma, (void)vm_flags; } -static inline bool mapping_can_writeback(struct address_space *) +static inline bool mapping_can_writeback(struct address_space *mapping) { return true; } -static inline bool is_vm_hugetlb_page(struct vm_area_struct *) +static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma) { return false; } -static inline bool vma_soft_dirty_enabled(struct vm_area_struct *) +static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma) { return false; } -static inline bool userfaultfd_wp(struct vm_area_struct *) +static inline bool userfaultfd_wp(struct vm_area_struct *vma) { return false; } -static inline void mmap_assert_write_locked(struct mm_struct *) +static inline void mmap_assert_write_locked(struct mm_struct *mm) { } -static inline void mutex_lock(struct mutex *) +static inline void mutex_lock(struct mutex *lock) { } -static inline void mutex_unlock(struct mutex *) +static inline void mutex_unlock(struct mutex *lock) { } -static inline bool mutex_is_locked(struct mutex *) +static inline bool mutex_is_locked(struct mutex *lock) { return true; } -static inline bool signal_pending(void *) +static inline bool signal_pending(void *p) { return false; }