From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 4AA8A2727E2 for ; Thu, 9 Jul 2026 17:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783619163; cv=none; b=mrJ9nLNI3G1GR/8m7kHGUjvHEWO6lKt5NzdI4JpQ64mShTIs5ffjQsqdSajKaxTn2iYAtHtIHVH7f31bpHsbmv7p39eLLJEveXN1DNyzZpFyOjEiBbKxxomanWagpgrARyfHYsrNunGZlasQMcB+B/qtuL8WvgsAmc+sqZFrmO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783619163; c=relaxed/simple; bh=Un/bs9oeLACKmC1wMvR6/6dAGBdxgguQUgmne0a98m4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o1Aw0ZO1+5Z2wLrxNFZXBNxsCtxivQYXcEJkTJGOsTT+ZmivsmUYsRcp8uvifRL4qFNUWqLj3V0cdNHbvpS33iKHjiX9PAUm2YvWn1fhbTI6dDjHTgyrAZxaJdrxzSgKrBnpCeqdutOLBYsiCguS+ejkwaXodFKqLDglXZ0WfhM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=bP+iyUSh; arc=none smtp.client-ip=209.85.160.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="bP+iyUSh" Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-51c2149571dso304201cf.3 for ; Thu, 09 Jul 2026 10:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1783619160; x=1784223960; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ARkFEEgQKbrHJZpn11PfpILDbZ2rflYjxDUaqEPQFVE=; b=bP+iyUShbfIfXF4Oge4++6DzoxAdgf3icDCzTeFKcBqALQVXkOcLfKxCWKCU+/WoOL 3slPJClco6cI9Xk88sEmGiezeT/UVW204WAUQT+ciORZ5pXnIudBfq+Bv4PCNnDOTpTs G2OXLcgQK6WLRSXaDLvkzzNlOaroMf9EN3vTffzExyR/5wX41XrDrauS0IsNFxssJw0Y SYJz41Z8PF9fBbYbvaC0VnkouIRT2L2k6hjXvTBf7AxSslpAoMUOeLIwc6JZ1Lmyo4p0 Kly4G39Mnwz8X0JvG2ElPp6UCylsjkfE6B2Lrf0GEvhmm36DeT0Vt3KnkEtkbZUYlzS/ pcSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783619160; x=1784223960; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=ARkFEEgQKbrHJZpn11PfpILDbZ2rflYjxDUaqEPQFVE=; b=lgWMpLy6Oi41XmAZr/SyHTitkbjMYfW76VxLfhP2oTlx/+au/8QnrWE0kHhxyNFS+h L0aIM/NTMd5fcRZAPYy8SbwOaEfT620F1mr0rjKF+t7JJT3oecAk0s2CYNpIIDZT2BXk UiQkZlBx7Glu94Z8f7SbJq1W2WoZpKVL8gOb3bWajPDW1eSu6R1QtFelwr2eS94aZ6QU iB7IrO2JMfA+eOYkyK4GSEbSk7SFAX1V6RlIYjWFgsB4BUjbTlmBrpqvKrC+n/AMKi8G lfvnhqpT5YHNmLYGu1mEzyHRehNlXG8kroRv+aQKzDj6fCLeMg4I1HTBI7yG8Iqgk0Mj kUFw== X-Forwarded-Encrypted: i=1; AHgh+RoVoIP+6OIjWu1ldpCNmSt0Ocrl9/rsTYIs4P/hM/qwjV0cJPHHAkpbo1ZPcX3cCDT866Fkqq16C4ZhSbU=@vger.kernel.org X-Gm-Message-State: AOJu0YyQqlhQcMV35uPLFEQ95N+tbib07DlQyK5TDIfkxJE7O6TKIpAY YDj3k8ogM60IB0QdGxfzP51fFybcbGorjYMj1Jp9ov7dnE/ULdF0E8Xay/3vejSHhCk= X-Gm-Gg: AfdE7cn/bhm8OaE+IgeiU9i0PoVw30ASmRZZmwOS9V/yo5NjwDJ6vNND4/fV/9Qncbt ltan7vXlTsKgzbsJMdKFD+e2zNwYqmoEVRGZ9nMQ4On/mswcsGmNjYhPW43V5OMtasBKdV3qTwc XYU/0de1hB8CLD5GjV83Yjn0gsgMOJ4+nF1UUJKmXNULUmiRQf8CRpwZ3jdOo97bp7UQziCMHxa ZSpqaCx3BsIv+jxbDvuKo1h8CKpEbrGTmCyf7xGCK4usjEjDR0FHm45lUzaxjD2eayN2kDWJl09 C070sUCiOg0tcXPiR0h3vBVO9hSXWOZeZQLKNW567HVToyEOjlkLXlB0aTScrVIisqu0LJHB/TQ w5vpXMFHaus9AiM49eH6JY5D62tB8SQFxaQDcKdMS4t0Pgb6IUOuKB8WfpkcuBtosyditSM4jWD 9ARssD1kpvbf8= X-Received: by 2002:ac8:5741:0:b0:51c:1361:fead with SMTP id d75a77b69052e-51c8b4160c7mr98674671cf.37.1783619160101; Thu, 09 Jul 2026 10:46:00 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd50df5e2sm22716566d6.4.2026.07.09.10.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2026 10:45:58 -0700 (PDT) Date: Thu, 9 Jul 2026 13:45:58 -0400 From: Johannes Weiner To: "Vlastimil Babka (SUSE)" Cc: Andrew Morton , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Zi Yan , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] mm: page_alloc: move capture_control to the page allocator Message-ID: References: <20260626182215.1107966-1-hannes@cmpxchg.org> <20260626182215.1107966-4-hannes@cmpxchg.org> 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 Thu, Jul 02, 2026 at 12:20:48PM +0200, Vlastimil Babka (SUSE) wrote: > Now my version (only compile tested): Ah, now I get it. Thanks. > diff --git a/include/linux/compaction.h b/include/linux/compaction.h > index f29ef0653546..66a2f70e9e01 100644 > --- a/include/linux/compaction.h > +++ b/include/linux/compaction.h > @@ -58,6 +58,7 @@ enum compact_result { > }; > > struct alloc_context; /* in mm/internal.h */ > +struct capture_control; /* in mm/internal.h */ > > /* > * Number of free order-0 pages that should be available above given watermark > @@ -92,7 +93,7 @@ extern int fragmentation_index(struct zone *zone, unsigned int order); > extern enum compact_result try_to_compact_pages(gfp_t gfp_mask, > unsigned int order, unsigned int alloc_flags, > const struct alloc_context *ac, enum compact_priority prio, > - struct page **page); > + struct capture_control *capc); > extern void reset_isolation_suitable(pg_data_t *pgdat); > extern bool compaction_suitable(struct zone *zone, int order, > unsigned long watermark, int highest_zoneidx); > diff --git a/mm/compaction.c b/mm/compaction.c > index b7878e4a2c4b..902573797f99 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -2792,7 +2792,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) > static enum compact_result compact_zone_order(struct zone *zone, int order, > gfp_t gfp_mask, enum compact_priority prio, > unsigned int alloc_flags, int highest_zoneidx, > - struct page **capture) > + struct capture_control *capc) > { > enum compact_result ret; > struct compact_control cc = { > @@ -2809,36 +2809,8 @@ static enum compact_result compact_zone_order(struct zone *zone, int order, > .ignore_skip_hint = (prio == MIN_COMPACT_PRIORITY), > .ignore_block_suitable = (prio == MIN_COMPACT_PRIORITY) > }; > - struct capture_control capc = { > - .cc = &cc, > - .page = NULL, > - }; > - > - /* > - * Make sure the structs are really initialized before we expose the > - * capture control, in case we are interrupted and the interrupt handler > - * frees a page. > - */ > - barrier(); > - WRITE_ONCE(current->capture_control, &capc); > > - ret = compact_zone(&cc, &capc); > - > - /* > - * Make sure we hide capture control first before we read the captured > - * page pointer, otherwise an interrupt could free and capture a page > - * and we would leak it. > - */ > - WRITE_ONCE(current->capture_control, NULL); > - *capture = READ_ONCE(capc.page); > - /* > - * Technically, it is also possible that compaction is skipped but > - * the page is still captured out of luck(IRQ came and freed the page). > - * Returning COMPACT_SUCCESS in such cases helps in properly accounting > - * the COMPACT[STALL|FAIL] when compaction is skipped. > - */ > - if (*capture) > - ret = COMPACT_SUCCESS; > + ret = compact_zone(&cc, capc); &capc, and I switched it to just return compact_zone(&cc, &capc); But otherwise it looks clean to me. I'd just take this as-is with your From: if you don't mind. Can I add your S-O-B?