From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (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 1E63E40DFA8 for ; Sun, 3 May 2026 00:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777767460; cv=none; b=jXOIngS685u4fj4iDCLa/FUCQ8HBNFPZZFuAhWM52dXX5V/AdNVfVEjfUEkSa3aqqx1+Sito2YgUIeabREhuAvnj2T+RinpWtDeYR1w2XgWe8ehy0B/4fJT7S2Z4YXpCgjoEZcteeRk//110d/G3ZyBoOMc9KHx5okoEVkrRSyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777767460; c=relaxed/simple; bh=1eDVujvedOmU6wVjW9gvYBqOF1iWnmP9s/zew37diJU=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=dZ+IpCfIIfRGliJq1bGSm/prd5cm+v0CtcJDkqfJxsNTQHcgZwRZcC7Gi2REkTsM5ofbM2M95SHNYldLrOpOBLhv3b5NbMmq9LOl5LdqNmf2ySda00NqgUFc9l4B6U/9ilSa1O3kNu9ZaC6Cy/PIoZC6b+P55YdzT4y7P4Wu+LI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--cmllamas.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UVhz4tmS; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--cmllamas.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UVhz4tmS" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-12dbf4f678eso16477877c88.0 for ; Sat, 02 May 2026 17:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777767458; x=1778372258; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Dk2xk2A0NiqA7ayNXkXUbXMOSECieHzDuDpYWSAHMHE=; b=UVhz4tmS0moxZHE0v6Br6YpQBVDomvktfOhuMXpBc9e0tAFNTkFa+eq/vKJpbI5Yje Mx0l8eCD+R/ZzNTKh8xOFueJGVQ6FB0GOLgWSF3Mt1kgqUcQif8rf0ZrXId/uZMycqvv yzAOMUlvyNDJlqwfh6Lu5Fe/iMoBhjMopc2mrZs5b3Kwd8fX9B1Es9ZjafS4TP2MIFOd nKdGEq9IYxtdh4HwG+NY92DN17+FO1dozEviYnNouF3qmpm3IuGZz20YeCOQwdeQucWy 83JI3/xOVUInRA8UdS8Uq1wCpnOFhdURIPIZ3k2ULFJcE9M22qOASoaPNxIOvE8vECN0 0WuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777767458; x=1778372258; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Dk2xk2A0NiqA7ayNXkXUbXMOSECieHzDuDpYWSAHMHE=; b=o0TiRlDpAZAHrdv1pC1WI1M2d/TyJD2a8/CcwKOM03Kre20VgYRoez7hb+rD4lsM7b 7MSeSZd43KA+fiMmg1OEU8uS2EUKk9dFli0nyDJN4tGsTLDMDSsz0knxNPXCSiBgeAdX zoKPKSnimTjORJTLQ1zy95MtKD0lyunDMgDb2M5vW1Dwm/WNNQdr82hk325wWudyYhaD aF0v7guUrQjOKwJRv18H2yI17mYwnNRnh5XU9I0tFg8mXT2pO6UV5JT4N/w/nJNkfrGV zrGY/D5hNiO8nu/pc6+7ZNg2qy+MxE/Tm2RBflgNuDee3aGoZNzOh8yK03FXbyiUQzng W4Qw== X-Forwarded-Encrypted: i=1; AFNElJ/w52sAEvhTK/0lGbNHclZ/XX1lxn9GthXGbbwKJAdB7RZv8mSrFa92FBv0Wcqx85TwQsSwpp9Zp3XVWVU=@vger.kernel.org X-Gm-Message-State: AOJu0YxWwf3+se/jCDInTALis+9bcsT/pcBP8178XTPDgGAe2fG2wRA4 MS777GztsXIToW/y2llttXdokL+U/noG9FCA0NiBr1XL6A+53bla9OorVhHFazAlGkn3/UTJQwE KOjew4CVYsCaAqA== X-Received: from dlag5.prod.google.com ([2002:a05:701b:2505:b0:12d:dbf8:a2a8]) (user=cmllamas job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:f9c:b0:12d:de3e:86aa with SMTP id a92af1059eb24-12dfd86e4c4mr2227104c88.40.1777767457805; Sat, 02 May 2026 17:17:37 -0700 (PDT) Date: Sun, 3 May 2026 00:17:33 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.545.g6539524ca2-goog Message-ID: <20260503001734.858296-1-cmllamas@google.com> Subject: [PATCH] block: restore mempool reserves for non-block From: Carlos Llamas To: Christoph Hellwig , Jens Axboe , "Martin K. Petersen" , Chaitanya Kulkarni Cc: kernel-team@android.com, linux-kernel@vger.kernel.org, Carlos Llamas , "open list:BLOCK LAYER" Content-Type: text/plain; charset="UTF-8" Commit b520c4eef83d ("block: split bio_alloc_bioset more clearly into a fast and slowpath") prevents non-blocking allocations from falling back to mempool_alloc() after the initial slab allocation has failed. This was based on the assumption that mempool_alloc() would simply retry the slab and fail again (for non-block). However, mempool_alloc() also attempts to dip into the pool reserves, even for non-blocking requests, and this option is no longer available after adding the early fail. This was noticed through the SCSI generic module which calls blk_rq_map_user_io() with GFP_ATOMIC. Remove the check to allow mempool reserves to be used for non-blocking requests, restoring the previous behavior. Fixes: b520c4eef83d ("block: split bio_alloc_bioset more clearly into a fast and slowpath") Signed-off-by: Carlos Llamas --- block/bio.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/block/bio.c b/block/bio.c index b8972dba68a0..e8f4934593b3 100644 --- a/block/bio.c +++ b/block/bio.c @@ -576,13 +576,6 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs, } if (unlikely(!bio)) { - /* - * Give up if we are not allow to sleep as non-blocking mempool - * allocations just go back to the slab allocation. - */ - if (!(saved_gfp & __GFP_DIRECT_RECLAIM)) - return NULL; - punt_bios_to_rescuer(bs); /* -- 2.54.0.545.g6539524ca2-goog