Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp542128rdb; Wed, 17 Jan 2024 09:29:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJs+J3IQdkVNl3sVv4Q4kuaTmM7IAX4DHUmmADcq0OEFrh0FKmlQXxPCVEEASx8L5AKyEq X-Received: by 2002:a4a:e0c5:0:b0:599:32c8:8dd5 with SMTP id e5-20020a4ae0c5000000b0059932c88dd5mr944159oot.9.1705512598563; Wed, 17 Jan 2024 09:29:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705512598; cv=pass; d=google.com; s=arc-20160816; b=isaY99nQJvR5ieFjCo+yAzoXpX1Nmvs+LG+T2ffY4FPu0nz/vTyOAs9jjkldQBK1Uw B5L5Fk6hPicQnnOeDWjTVKYasim8zVlGNvnNSn6qbJSpemGFvwb+4QSkSfy+Jzfm7h/7 4U7CAf3+DwIfBc/q+3jtIniRj9i60E1CJi/l3V7rWnN98skDp7BWdCfohklMYPq81XM7 rbCBscVeuZWpAgu9T9wYobIEHnxtSDvht43w7+fnRUWJfX18TNsEYAY2woqEShQ0n1e+ SUmjmeTynEF3g4YtIzSDyaj6yz5ZEQpFT9eX+GlI4RsBJ3L5sk6QmoZRgRulI+tsEaWp oXbw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=KdFUEs5+PqYWiTaTyZYNjEQamHx46wf3N9eVAnVojFA=; fh=qK7Psf0fhaw0V9B15n+LZOaJpbJK7zDz1gW1a8fWAaI=; b=XoC96VpHPyjqpMkqnTJnLRCUryGQ3URFdetnASxUr+TlUhduX9p5hYWUYP5MnU3fQ9 eabo34xbdAP3JCcmK+Jh9OXvy36A+SrwQTD2ed22wf6fLMnCW+zykoKslrAFErv+WYVw g+q8jZYSg+Yd/k33hrfFa203NAzpWBAT4w0AyfeAE3q5IISWau+KUY1aljxhOdsXM/U0 /WoSthRRv8XEtbfwW+cPdp+Y9h1A6+VHFmF55KWcQmr9OeyRzMkfsSBKwTE221UJRZ9+ Vz/PRsbIOWlFShptKIPmKgc2xTwI7QVAXw62VvjMdIXRss/KFf62N8wOtAeSnw+UIXrr h3hg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-29272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g16-20020a63dd50000000b005cdfe08f428si13760009pgj.645.2024.01.17.09.29.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 09:29:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-29272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 305E5285357 for ; Wed, 17 Jan 2024 17:29:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86A542263A; Wed, 17 Jan 2024 17:29:50 +0000 (UTC) Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 C6EA722619; Wed, 17 Jan 2024 17:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705512590; cv=none; b=DpHN+nf6iZkNeNP/LtW/MHFAYEt8HNj5cC57VqqQhBAX2l8DuHwjdlQyA+HKtJAyU3KUs6sFIpiBs7RleTJjurZHSZrrp33QUBeckslc6nEfhXHsE+A8jj0ZGb9jecll7jLcjY8m43B+/wDV71WIa63KFxAsgEtXL3c485JJhao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705512590; c=relaxed/simple; bh=3RguxiLQXwXyKy+/MBUXqv78BPdbE9j/r5/BDuDJGGQ=; h=Received:X-Google-DKIM-Signature:X-Gm-Message-State: X-Google-Smtp-Source:X-Received:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:Content-Language:To:References: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Mhp4HbHjwSMBNPPjkfii7zUzGQSlwIJPyxsZZyUFe0ptdOjUW/7qAEL/qTkCk+ud6nupFZDW3DBkvSWL2026HYvraWLwj7ZbB+TQ9JbFk6GVLrXtMWvCQULwu1U1UoLCAsZCm8lnfcJ6uBsgAgZT40oWa7iKWNL1HTPI0LZD65U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=acm.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6ddf1e88e51so5480393a34.0; Wed, 17 Jan 2024 09:29:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705512588; x=1706117388; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KdFUEs5+PqYWiTaTyZYNjEQamHx46wf3N9eVAnVojFA=; b=hXjj3WE/wWjU7aeiEwx1BCibpQpWCg8O5k6mPWUP9RpxF8WpSKa2BkT3qyJ2Yebswv W3kk2M2q+TbjAuqiTPeH0PKF4DUBayWy+hiDVTy25H+Sl0bW4BpbAUEr+4HhsaXUC3ML 6jZKGrsaM7oe6YaTU+4oCuPxTbCMBSPQLMDtog9Wz+nkHHbf59chhL8c+IUc7D+I7Q8u UGJTOYBGYjPzjd/xqayj8Z0CD7o+sNyTaC3DBjlXBngY4JOUEwKPYutikfsCiY0gtb/a yqpred3M/ftkHGJhiC1GY+ONVEi+IsNg0sMnVc5EhANeIzbHcYbZq1I/+potw/yl3D51 ZJPA== X-Gm-Message-State: AOJu0Yzo1mQGT0Lt+7hkUfpnCFui7sSsWJsxt9rP5iwkg+lnsqFnRT1R 4t6pGBT/WhKce0BMwcxLKuA= X-Received: by 2002:a05:6358:b107:b0:175:55e2:c8f6 with SMTP id a7-20020a056358b10700b0017555e2c8f6mr10907066rwo.31.1705512587678; Wed, 17 Jan 2024 09:29:47 -0800 (PST) Received: from ?IPV6:2620:0:1000:8411:5421:8f53:45a:4e37? ([2620:0:1000:8411:5421:8f53:45a:4e37]) by smtp.gmail.com with ESMTPSA id ca33-20020a056a0206a100b005c60ad6c4absm10788772pgb.4.2024.01.17.09.29.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Jan 2024 09:29:46 -0800 (PST) Message-ID: <5ff36535-7cd3-4e8f-a477-9d2a98d18dd9@acm.org> Date: Wed, 17 Jan 2024 09:29:44 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 1/1] block: introduce activity based ioprio Content-Language: en-US To: "zhaoyang.huang" , Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com References: <20240117092348.2873928-1-zhaoyang.huang@unisoc.com> From: Bart Van Assche In-Reply-To: <20240117092348.2873928-1-zhaoyang.huang@unisoc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/17/24 01:23, zhaoyang.huang wrote: > +static enum dd_prio dd_req_ioprio(struct request *rq) > +{ > + enum dd_prio prio; > + const u8 ioprio_class = dd_rq_ioclass(rq); > +#ifdef CONFIG_ACTIVITY_BASED_IOPRIO > + struct bio *bio; > + struct bio_vec bv; > + struct bvec_iter iter; > + struct page *page; > + int gen = 0; > + int cnt = 0; > + > + if (req_op(rq) == REQ_OP_READ) { > + __rq_for_each_bio(bio, rq) { > + bio_for_each_bvec(bv, bio, iter) { > + page = bv.bv_page; > + gen += PageWorkingset(page) ? 1 : 0; > + cnt++; > + } > + } > + prio = (gen >= cnt / 2) ? ioprio_class_to_prio[IOPRIO_CLASS_RT] : > + ioprio_class_to_prio[ioprio_class]; > + } else > + prio = ioprio_class_to_prio[ioprio_class]; > +#else > + prio = ioprio_class_to_prio[ioprio_class]; > +#endif > + return prio; > +} I don't like it that code is introduced in the mq-deadline scheduler that accesses page cache information. Isn't that a layering violation? Additionally, this approach only works for buffered I/O and not for direct I/O. Shouldn't the I/O submitter set the I/O priority instead of deciding the I/O priority in the mq-deadline scheduler? Bart.