Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp988167lqo; Thu, 9 May 2024 01:02:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV2foS/T7VTZouU3+/Q84avLO6wqg03exao1ZbvxvMUQ3bVwfDBRDktM91/ckLNKy9T1z2oEJP55HUVC48q5fWNZ2/c63GXrBNIZojxgA== X-Google-Smtp-Source: AGHT+IGmhKlnqL9LgdHa5k3aXdfI/D+JVgVm4nL8y6TD8XKw50fJvDHi9TzjVk+VDqHrGRKkv0b6 X-Received: by 2002:a17:906:ad88:b0:a59:a83b:d43d with SMTP id a640c23a62f3a-a59fb94baa1mr278142666b.16.1715241764319; Thu, 09 May 2024 01:02:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715241764; cv=pass; d=google.com; s=arc-20160816; b=gZZnIaPqKlPFX0PMbCFDrStCK5nz6u0hnr66RiShmmqnHCC4nzHNt1vmg/ELeI8heL B9IHSim5LpyAIncd7YS9QKG4Wr6gC67fluT5Uk+kqMZBFe2/RWVSjJSWp5ccpvYir9z9 FldeG4zO/WjDD6QTxZqdjz+MUDXXEOZEL+9MMpgqNwlHdsD4+dT2KUlEojtTuHYI82hF zfkEu8jKTHzhouV+v+1GkxoX6b0i2HT2mf46rF3IXuZK3b7ArA8/YbT4+2197UJRm8Is tHm3SJD5mA3Q0JDIs9bFhDOnAj9icojUI7Ye+cmBn+LT+KpF5kCthv5BG123tDBNGyUf JiJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/wu4YXBKwfk99ZTZ+xV3JcQCiIw42eOgTlfbES8hZQw=; fh=ijsqagkQZLVlgJEyAUk+b8QIJ1j4NeR8QFvyoOY3Hes=; b=JvigDYit9Zk4LWF5n65Lgw26GkLUvCLURO9RmoJ6oyJMp2CvQqBhjyU/9lRPJmZY0M 8DHftKuFHAewgByPk0wiWOAINFalg1Dly0K4PdxPoZSMqAXj42hkbHw7hC/JPUBSW44P 7yLUCXX0RzPpn3Ej2L5cj0UQjd0BJMZnxHQcsQdiS843vwpu6qmyFe+fmjE7KUAz+5We LOZr+WwFhtTcMynoITKmTPQmlW1umTHXIcNsOvf2M0ccq86gnjAMMar2Cb4l3GQI0xHU nhGuvVl8IPEfsOqL5nhjE14SMxQECJLLbg8ANYT0vfhRQk3oqyFQWxD1efcRls9bByPZ 19ww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=a9i7tfdE; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-174082-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174082-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17be66edsi50458766b.761.2024.05.09.01.02.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 01:02:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174082-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=a9i7tfdE; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-174082-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174082-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C61571F21E3C for ; Thu, 9 May 2024 03:15:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1125B147C71; Thu, 9 May 2024 03:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="a9i7tfdE" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2CD98593F; Thu, 9 May 2024 03:15:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715224548; cv=none; b=kao8Kmjb9bgBK2ha5Ooc0AZEhLpF3PWD9YiaFG3fhXXnH0mvwUxTR0C+BS024G2bpf9ytSmshti8+4dvxKU53awErWEeGM1k5HKG66cw9F0HVnMriY6CULKKK4eUOEf5e0fKcT7LKojqHQW7bBVB2ICt5m6BzCrqyvMv29ZNHPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715224548; c=relaxed/simple; bh=CGIq7jyOB8znUivjHG+vO6j8CqP28PE4BYFYgt3YL6I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XCuqiHD2uxAogvWRSEP5FEPjT9SNoTD9U0L5wlp7gGFM6UI6Gzpfy6ct0YqBT37cNAIoAXFANuAIeFbx8UK5uzPqfSrJ0TGlvwnh9GZMNGW/guOlNRN6atyPpP96SmNp0N233EqmITSg6P1hTSNfYsFmG2B0EZJcFCIFuHm/Cs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=a9i7tfdE; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=/wu4YXBKwfk99ZTZ+xV3JcQCiIw42eOgTlfbES8hZQw=; b=a9i7tfdEdRkT7XmPd9BnxJ8hzM ONnvBogV90YxNQ6vnro/R048i09qg+UAV4VNCHpXAI7nW2kaYPOXPHLD+SA8/oHPU4pmXZ0/hEJ08 zm9frcbKsJieQbMCGoipP8IknzFc4rCR8muf0yCbcjqTmy4MJjJsYQa/sAkYCd/RiCb2ZXFMmhlF4 RDVOE0t7v+8L3t0jYiNuodUxRRE40kgZgfVFDMZj5Xg2LtZ+GKpm98bkDuuDD6fa+ED3P5x/ivHTH 9peCi8ZhzjwwH1KbapJfwjPdbBR6E4ay0oS+AWcqI679kBivAazPbe295afDCciiBN+6nOt8yJAzY 3b7K/3pA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4uFl-0000000H6iy-2Cag; Thu, 09 May 2024 03:15:29 +0000 Date: Thu, 9 May 2024 04:15:29 +0100 From: Matthew Wilcox To: "zhaoyang.huang" Cc: Andrew Morton , Jens Axboe , Tejun Heo , Josef Bacik , Baolin Wang , linux-mm@kvack.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com Subject: Re: [RFC PATCH 2/2] mm: introduce budgt control in readahead Message-ID: References: <20240509023937.1090421-1-zhaoyang.huang@unisoc.com> <20240509023937.1090421-3-zhaoyang.huang@unisoc.com> 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: <20240509023937.1090421-3-zhaoyang.huang@unisoc.com> On Thu, May 09, 2024 at 10:39:37AM +0800, zhaoyang.huang wrote: > -static unsigned long get_next_ra_size(struct file_ra_state *ra, > +static unsigned long get_next_ra_size(struct readahead_control *ractl, > unsigned long max) > { > - unsigned long cur = ra->size; > + unsigned long cur = ractl->ra->size; > + struct inode *inode = ractl->mapping->host; > + unsigned long budgt = inode->i_sb->s_bdev ? > + blk_throttle_budgt(inode->i_sb->s_bdev) : 0; You can't do this. There's no guarantee that the IO is going to mapping->host->i_sb->s_bdev. You'd have to figure out how to ask the filesystem to get the bdev for the particular range (eg the fs might implement RAID internally).