From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 F1B6342FCD0 for ; Wed, 12 Aug 2026 11:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786532547; cv=none; b=AkYd3fT1a7R8ZgX349Lm0FVGQ1vE7PicNTTRJZyEbiMGkwAkAD0LcKMuPBkGIVhCVHwykiQ58piT7RwuNtszJ6YIlT0Gar98LXeJ0DCyyyRDX3/i5eQHi+qlp3gWTeV37313Bv9Xy5xGh6k3hUjLc7Zs7kib+FEix0s+M1Ugztk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786532547; c=relaxed/simple; bh=AsHqDVs+KRPHV9KXrVA9jozAUPwWu6WiTJ6sMm93gcA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EGp25nASNVGN+5Kyl5qgbh0Xhu+HCj3fFibG5DOZZX3EruBrxwU6guJt5bk68h27r2VZgzRo4m48h0b63TfrxVRukgCs2Lzs9J5TOE64BEW4KohhV7xZGJt29kXIieZ3v+Uale5i5rwjxmQA8ZITDD4vtG4ifojPpaIelwEvNew= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=H1JzWXKL; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=poLI3x/t; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=fV6me2Yo; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=CyVqWLWZ; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="H1JzWXKL"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="poLI3x/t"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="fV6me2Yo"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="CyVqWLWZ" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id F06518222B; Wed, 12 Aug 2026 11:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1786532540; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HXMJf/rtkN5D9V2wByXeXTPbkMFZmsjZxH0GM1aTCuw=; b=H1JzWXKL/ONpTLM08OtA0Vz7IVhqGSFS0bMs+kCcnoIWV5QrFmsVZnWZvgfEgOwiNfZeAs hT4qYuPHDo+KAp/wkscibRimguZYXup9roYuWUgaeAK838YFHpiyM5oK34GsqAxQVnbgpy 9llJlnH70Fsl8eR0VP6ch5q8dQFMjfg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1786532540; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HXMJf/rtkN5D9V2wByXeXTPbkMFZmsjZxH0GM1aTCuw=; b=poLI3x/t9XFPw2AKM8C7XATPchZBXv521jGBjNoeIEGya4U4LD3hL8+f0cGsJ9TuHQ+yDc /IImpbWPzRG6O7DQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=fV6me2Yo; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=CyVqWLWZ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1786532535; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HXMJf/rtkN5D9V2wByXeXTPbkMFZmsjZxH0GM1aTCuw=; b=fV6me2YoS46y0WhL8LHI/+xY0QanZ1MgQqj0V59lONnpH497IJubkCf3lAmQCZDqzHV/I4 XCB19yfstm98RAhXKv4DDbGzsuuM80o0AmaQkVu5w3egb3Sih9VKnHR+9qSxLQRiDnjbS9 tPn9CmFPCsarTf4c7V/iv2nVsGd3GuE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1786532535; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HXMJf/rtkN5D9V2wByXeXTPbkMFZmsjZxH0GM1aTCuw=; b=CyVqWLWZDYn4xeqYqs3uOYbuvtbBROnZ5VTkM6ZE0hFPB+JBCVSYv7j6WEpBcdVrWq/Iox xzLbY7n9NUCSKjAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5AD1A779B1; Wed, 12 Aug 2026 11:02:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QYzoErZSfGp1VQAAD6G6ig (envelope-from ); Wed, 12 Aug 2026 11:02:14 +0000 Date: Wed, 12 Aug 2026 12:02:12 +0100 From: Pedro Falcato To: Breno Leitao Cc: "David Hildenbrand (Arm)" , Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Youngjun Park , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Hugh Dickins , Baolin Wang , Peter Xu , Johannes Weiner , Yosry Ahmed , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH 2/3] mm, swap: distinguish a malformed swap entry from a dying device Message-ID: References: <20260810-swap-v1-0-375ef0767206@debian.org> <20260810-swap-v1-2-375ef0767206@debian.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: X-Spam-Score: -4.01 X-Spam-Level: X-Rspamd-Action: no action X-Rspamd-Queue-Id: F06518222B X-Spamd-Result: default: False [-4.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; MISSING_XM_UA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCPT_COUNT_TWELVE(0.00)[26]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[kernel.org,linux-foundation.org,tencent.com,huaweicloud.com,gmail.com,linux.dev,lge.com,infradead.org,google.com,suse.com,linux.alibaba.com,redhat.com,cmpxchg.org,kvack.org,vger.kernel.org,meta.com]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO On Wed, Aug 12, 2026 at 03:48:56AM -0700, Breno Leitao wrote: > Hello David, > > On Tue, Aug 11, 2026 at 05:36:31PM +0200, David Hildenbrand (Arm) wrote: > > On 8/10/26 18:26, Breno Leitao wrote: > > > + return ERR_PTR(-EINVAL); > > > } > > > > Is -EINVAL really the logical right return value? Running into bad swap entries > > sounds more serious to me than "-EINVAL" :) > > Good point, maybe we need a strong drug here, what about -EIO? > > I picked -EINVAL because it is what the swap code already returns for > this exact condition. > > > * Returns -EINVAL if the swap entry is invalid, which might > * occur if a page table entry has got corrupted. > */ > int swap_dup_entry_direct(swp_entry_t entry) > { > si = swap_entry_to_info(entry); > if (WARN_ON_ONCE(!si)) { > pr_err("%s%08lx\n", Bad_file, entry.val); > return -EINVAL; > > But, I do agree -EINVAL is too soft given the situation we are in. > > I will return -EIO in the next version, if I don't hear any concern. Perhaps -EUCLEAN would be a more fitting error. It's generally what filesystems use, at least (EFSCORRUPTED = EUCLEAN). -- Pedro