From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A24D5310620 for ; Tue, 26 May 2026 15:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779808950; cv=none; b=nUTRy160kPspt3ha+I78nsVQQK9aA5epElvJmsrxhe6FeFiuX2aAWwJiuNgpOiqKguWjMyVFsYSkhAVLzDfgd3tJIWnRTUCLvA2lnhtZSRzSV9BCXhuXqSpecmxqO8vL64qRP4b2CdpVeFkOZYOwtPb3pc0pQG3IOXy2X4EoYHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779808950; c=relaxed/simple; bh=qlN1zRUWO6+cWDijxXFEMqWFn2SJusaJqM8emMbmU5M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AmC5whJ7jTftYG3vYDN5U6xH0yBeysXTxmo4gJNltSJAxe3MM0uRGR/I84mejvtvAEY/FpvATGctpS1+XKSVJAHQbQ0lFHWCaXlwHUWnwzx+0An4AGogcwBbkGJFRLW4+IdRSskuQVXZYYmVbCMbpYa7UVJNi4Nq95oXPu1ojl4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=uADq7q4P; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="uADq7q4P" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-914b03e42b2so579891585a.0 for ; Tue, 26 May 2026 08:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1779808947; x=1780413747; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=aN8WQ4CugWF6CWlj2xPxBqc9Jwi2zwDC9nUPjhKPtBQ=; b=uADq7q4PLOzr5/rCQQN+8NVSyFmuq96VByZjMzmeqyS7XvyvPFhSCTSqCPccDNt7Iv XRgySzsIWoH0rPPBlvsnFiJB6xprWBDoqsmrxmBi1+4G+1eSJ20+rXE2fREHyTTIJZdT vr/lrxlCyU83Mlu/ynqM6KZMAakurIi8KVo836Z9zHQ95WR2H7oUXrZXH7aiG3XgcGYC U0GgG/o+qX/Sh2aa9eaPV6VdlQ5STtNFlilqyfiJhusa3LaDz7ykoF/+UvWiIWPAGl+x bAvI81cRCE1HMep02Cvrx0zG2tX1dTMpR2jrcAMu+fY/cSiWzkwcFVSv+NQn9dqq1i6l qdUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779808947; x=1780413747; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aN8WQ4CugWF6CWlj2xPxBqc9Jwi2zwDC9nUPjhKPtBQ=; b=HK6DOEO1yoD1QBsaMg97a/uojL+f9Gj1l8vKfDdKLPifgBOPBEwXr2bLcaLTi9Hpl9 tv38nHOXe9fFM8LdhQ1sjXs7knJU77/+aOi2qamyv9xqrPNThZZQck0IVakJI7Sg4BEY h+2UnqNKQUUq/4GJfAVcRGSEjnpeMpN8wVLlvAkWj4o6YkiRnc7NVBmtFqLkRO+AHXPs 4WBUsjDBGeGK0YOhIvlbDY49wBBKxt5bRt8vPBKJ4bFLPpzh7xQDXJgYsZos6mI6r1Ha VRzffv1lS2ZA5vQt7qrVS26po3ROk6QTChvoXDDuezxDdtdmTnilxWwmEv4HEFURunBf DwRw== X-Forwarded-Encrypted: i=1; AFNElJ+h3K0JYEPiW6z6KuQrXFHh/qJiQomb076XIj6SJGKbnXQBsqd0YZfzVxhwFdDS9q5msjwhMTlisDUDmro=@vger.kernel.org X-Gm-Message-State: AOJu0YyRynu1wfh6Oroooskz+LpZtnLsvSbjQlKjHkb5Lj/Nb7+GO8Zg t081o77MXFMVODaz0DsmgLzFJE84zExqwtw0ZY0lyQ3ThfuDeiSzpZ1mAFx3jGliFLA= X-Gm-Gg: Acq92OGymV/IVknO9GTF8XHPofze8R5kWjm2PPM0wPbscSUIURR1Om9h1246PHHvilK fw0D6IQpnx12ZIJTalT+YNH0G38sfTaOl7e4XBMihK/FrQ9zvEu5kBX7/naJ+EBr3coTJuhyGGo b7ot1PM0AzNRlWoIaHhLcpvxeonNhxcNysnjVVCYaxCQa38P+5uZZ6Ww1GNQrPau0lVl7NADeFY uLMGfKiIjbDNjZIBBDfG7ytz+gPVvvVjdPT3hymNqxYZGSvdlHDwsd+TTGu4rfTnEC9DUMyxndm Ej/0Su1lkhyKYWFP7yrwfnCbJgWmxdTbV+JS5JIqhx82L4lznD/Q58TktPpi9GDM+98Hhd7PBl7 eW9jH0x593AkOMB7/BbnMhsHO9OT79ukqfRoh2JFZkAhH36weLMsTzYw9fxfPfGPeX6Xg/tkQb0 MrOS9Sdusn351IUkAcSJDyHgmExBZBdWqHVRm8OmTeCUBHsKH8oY/5bAU0Y3LXQwkVRuclGO8j0 uiUFHh0GkSxg1Dx8fX1AjY= X-Received: by 2002:a05:620a:2245:20b0:90b:584f:7f1f with SMTP id af79cd13be357-914b49a31e3mr2074749085a.48.1779808947504; Tue, 26 May 2026 08:22:27 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-100-36-248-188.washdc.fios.verizon.net. [100.36.248.188]) by smtp.gmail.com with ESMTPSA id af79cd13be357-914f86ff80esm232992385a.13.2026.05.26.08.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2026 08:22:27 -0700 (PDT) Date: Tue, 26 May 2026 11:22:25 -0400 From: Gregory Price To: Oleg Nesterov Cc: Alistair Popple , Andrew Morton , Byungchul Park , David Hildenbrand , Joshua Hahn , Matthew Brost , Rakie Kim , Ying Huang , Zi Yan , Jann Horn , Kees Cook , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] mm/mempolicy: kernel_migrate_pages: simplify the usage of put_task_struct() Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, May 25, 2026 at 10:27:06AM +0200, Oleg Nesterov wrote: > On 05/24, Gregory Price wrote: > > > > On Sun, May 24, 2026 at 06:57:59PM +0200, Oleg Nesterov wrote: > > > > > > mm = get_task_mm(task); > > > - put_task_struct(task); > > > - > > > > Hm, I was a little trigger-happy on that review, I just realized that > > this increases the scope in which there is a task reference held (i.e. > > we're now holding a reference across do_migrate_pages()) > > > > I don't *think* that's an issue, but it might we worth looking at the > > changelog to see if this was done intentionally. > > I did this to simplify the code and the next changes. We pin this task's > memory across do_migrate_pages(), so I think that delaying put_task_struct() > doesn't add too much. > > But of course, this is not necessary, I can rework if you don't like it. > Not necessary, just a curiosity whether holding the reference across the larger scope has any functional difference. Like I said, I don't think that's an issue, but might be worth just checking the history on the function to see if it was done that way on purpose. > Thanks for review! > > Oleg. >