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 D45EEC3DA41 for ; Wed, 10 Jul 2024 19:15:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 56C286B0099; Wed, 10 Jul 2024 15:15:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51CA26B009E; Wed, 10 Jul 2024 15:15:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E3EC6B00A0; Wed, 10 Jul 2024 15:15:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 20EEA6B0099 for ; Wed, 10 Jul 2024 15:15:11 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 95938C0245 for ; Wed, 10 Jul 2024 19:15:10 +0000 (UTC) X-FDA: 82324795980.14.467A90D Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by imf14.hostedemail.com (Postfix) with ESMTP id D03AE100021 for ; Wed, 10 Jul 2024 19:15:08 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="oXIbBg/7"; spf=pass (imf14.hostedemail.com: domain of hughd@google.com designates 209.85.128.170 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720638893; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xpJH7O0IK+mWa36m8icY/tzE/YoR+c7Wf4G7xE5ZzLM=; b=jGEtQSC3ZmxQkvvAgWjyGXONev7XcBmHJsmmcNLkYaYSy2XKxVvM9T0lOs/39nxdX02sN0 BbEceG0NQWS3/JYc61uXc7d+Zf3B4C5wor+Fzpepj0VBgQ2MuHdvBcUNvZp7akdh+A7+L8 g0EiDpDZYsj83zGgKADvCaOsvM7xcNE= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="oXIbBg/7"; spf=pass (imf14.hostedemail.com: domain of hughd@google.com designates 209.85.128.170 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720638893; a=rsa-sha256; cv=none; b=1+8v+E+NUgQOuxOExLChbUpf7jdETL8WPKe/qhDiH6ahP2e4rCjcVo33pfDMtpj99kN06O 9SmJI4go6h3pT+uLERHDM/4txzfphUhZ10PyCIlnEf/bUVo5hRSd84DAAoALN5elbmgML1 A0XcOOry+hhFWrf9huUcTy7/xr9FnNw= Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-6561850a7bcso922687b3.3 for ; Wed, 10 Jul 2024 12:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720638908; x=1721243708; darn=kvack.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=xpJH7O0IK+mWa36m8icY/tzE/YoR+c7Wf4G7xE5ZzLM=; b=oXIbBg/7CnGPaqe/MxcmKVZJJUn9eEXWtvBDRVHhj+vG8erEH6MANC//RHOilQckCv PfvYDJcjFvnHpHysQ6d9U5VOwpP6GraKy7k/Llruh0PIrCQYYj+jvg30RJyEtEqgRewL zLQEI0KOfpYnR7evaVtrlZxmVxM0dVDfEENFLN0C1OsbxHtd4LWlm4rk0MWzxsRDJtgQ uQTouy/FgPqB4DrEpB0g2/NNcig5HYnd8jLozUQbD2duy2SnV/Zn9+sZGKhXMgBEOE7X Kc9fnSA/YSOX09o9EOHgK/zo3Ka96uZitw9oZgUQ36cIl15xGQzal2go8R2caWhHwSye j8OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720638908; x=1721243708; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xpJH7O0IK+mWa36m8icY/tzE/YoR+c7Wf4G7xE5ZzLM=; b=dv5DvPrJzjp8yIoSLMAeqyjJvcwuJ8W89dJNkCnJ+bdhv+CFKwy6GwZzSmfgv5730s 786oO+DBe+dceQoDUTDP/NRbtTOs3onhbxAAgPSxyPezzeSXTigDzqEbak3Sk2F0L3ky tOzACuKUD8AWow+fbrgsuBJvVJWreoHGAbYBa/LW5wc8ZM7anHybj21hxuxOeQicqmvW x2akHurQv1z1o1s1US1gsc0jdCRSr+pVAylB+c5VCDBu4JrFbrh44GB5BjRWpZlp4y3f 6WIQbGrNsvVLCKQ17uFxZTdzLtofXrkPCarzO3vUae+RV7pw47XEiwK2bk8OeGqtwxUP jouQ== X-Forwarded-Encrypted: i=1; AJvYcCVyLT3XuxvRL+LoTyABetjvls3oVHz8MMJggq72qTDBy5lvu6MugDeCAZ6nmQ3oi3zVZET3rB+xW4BRoNdlGK2H7gM= X-Gm-Message-State: AOJu0Yy3gUbcUR5oE4Af420nLo+9hfXHI+JIAhWlzgfHk57TEMh8VbrS Kr+cJFJIRNPuaZKpd5hgsaOqwY3B3pqX2vOjETSS82Bx/99HL/7OOu5d8LBtTw== X-Google-Smtp-Source: AGHT+IFWZTHBjlwLdnh07cjhHTC+j0sZPJwKS9lkD9EQ+SwBth2W8WJCPyjo5BJ/hREJijMn9wPueA== X-Received: by 2002:a05:690c:ec5:b0:630:de2f:79b8 with SMTP id 00721157ae682-658eed5ebd3mr74295227b3.13.1720638907584; Wed, 10 Jul 2024 12:15:07 -0700 (PDT) Received: from darker.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 00721157ae682-658e4d2d5d1sm8308867b3.55.2024.07.10.12.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 12:15:07 -0700 (PDT) Date: Wed, 10 Jul 2024 12:14:55 -0700 (PDT) From: Hugh Dickins To: Usama Arif cc: Hugh Dickins , kernel test robot , Andrew Morton , Johannes Weiner , oe-lkp@lists.linux.dev, lkp@intel.com, Linux Memory Management List , Chengming Zhou , Yosry Ahmed , Nhat Pham , David Hildenbrand , "Huang, Ying" , Matthew Wilcox , Shakeel Butt , Andi Kleen , linux-kernel@vger.kernel.org, ltp@lists.linux.it Subject: Re: [linux-next:master] [mm] 47325a5c88: WARNING:at_mm/slub.c:#free_large_kmalloc In-Reply-To: <2fe63ea9-613a-4904-8b68-134442c43261@gmail.com> Message-ID: <75bc4bf4-afe0-a1e0-36bb-1fad7ecee210@google.com> References: <202407101031.c6c3c651-lkp@intel.com> <053bd429-ae19-4beb-a733-a7a838b1e010@gmail.com> <4bc6400e-6199-4147-9399-4a54c94613fd@gmail.com> <612af749-0a59-f91d-693a-43d6217ffebb@google.com> <2fe63ea9-613a-4904-8b68-134442c43261@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D03AE100021 X-Stat-Signature: 6uiq6x649cpifphbhb7mjg9i8zuh36uq X-HE-Tag: 1720638908-554043 X-HE-Meta: U2FsdGVkX18tMPiedBA5hNeotB4q43oelEZ7Y7lZNT2wwNuQbNF4UKLSrCorc07L7WZ7h7rZEiRxzglNtNTMLvgH5PUwtvgFd1nD1lNemceiClW6VHhMhGyvz8OZ+QA2R/IrOml9EhUx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bKLZ6A69m7F2PgG3iW6WZWvkTvfuC5s7ALdx5sCwgEZnfFnpob5vLiygGc5Mb1wRclwbMShWIZ+F5RmTVe7Y/9SIQzVrau9LZb+VEK7HCia+ok3kKQSqt9URK1o1sLU6HDbhh9diqk3RwDFgV5aGvQpo0OGGw+6F 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 Wed, 10 Jul 2024, Usama Arif wrote: > On 10/07/2024 21:49, Hugh Dickins wrote: > > It's a long time since I was active hereabouts, but the bot report > > and your flurry of updates make me think that you should step back, > > slow down, and look more carefully at the precedents here. > > > > IIRC, the main problem is that parts of the swap_info_struct can > > still be in use from before while you're wanting to set up new values. > > Observe how alloc_swap_info() may return a fresh or an old allocation. > > Observe how enable_swap_info() is called after getting swapon_mutex > > late in swapon(), once past all possiblities of error. > > > > I expect that your new zeromap needs to be taking the same care as is > > taken with swap_map and cluster_info: to be safe, follow their example > > in both swapon() and swapoff(). > > > > Hugh > > Thanks, yeah sent too many in quick succession :). Will be more careful next time. > > Both the 2nd and 3rd version are careful to solve the problem of using old allocation > which you described. > > The 2nd one takes care of it in the same way as swap_map. It didn't look like that: it set "p->zeromap = zeromap" as soon as zeromap had been allocated; whereas swap_map is only installed later via enable_swap_info(). > > But I believe its unnecessary to do all that change in the 2nd version, when you can just > set it to NULL after kvfree, which is a much smaller change and takes care of reusing old > allocation equally well. It's possible that there's a good reason why zeromap does not need the same care as swap_map; and it's possible that things have changed down the years and swap_map itself doesn't even need all that care. But you haven't persuaded me: I repeat, step back, slow down, think carefully about why the existing sequence is as it is (and please don't respond without doing so). Hugh