From patchwork Mon Apr 15 05:57:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10900127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE1221390 for ; Mon, 15 Apr 2019 05:57:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A839C2882F for ; Mon, 15 Apr 2019 05:57:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CE3C28831; Mon, 15 Apr 2019 05:57:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46ABC2882F for ; Mon, 15 Apr 2019 05:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725798AbfDOF5P (ORCPT ); Mon, 15 Apr 2019 01:57:15 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:49640 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725777AbfDOF5P (ORCPT ); Mon, 15 Apr 2019 01:57:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1555307835; x=1586843835; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rvwMfsgUiX0pwQOFDexTA/LWfaE/7S6aOz5IeajEt4w=; b=L6mTNGqbCnWlOogHLOYAHMLFXUEPA/ixiI7g8q3uhMItNXxDqJRKjBnK YLLMOFYIalfkwsUmGkhltJz8mS5ORF2YYbNKK2vog+grIdha9fRT+u6wM 6R8ZcbR/eqCm/tyP6E2z3ys3XgxvmHGBEsUU6raPlrJ8tmdH/yC6GxZ2k u69QdWE4WHwAGyc9jbhz0qhA2VUI3nmUorltiSjWKvDQsNSXENYF6YTnt Vw8exQEc7XmthpRVCHfWokjoYxXXqBdHHa9NZ0L7OCVTMsXTf6dq9stEM cz12kz4z6uRZKVZERmBoAlII+fXkWGS2Mrfx9qGX1sjSzIbDNPvK6mQvJ Q==; X-IronPort-AV: E=Sophos;i="5.60,352,1549900800"; d="scan'208";a="107192422" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 Apr 2019 13:57:15 +0800 IronPort-SDR: yvERQJVOXdW2Y+TYui6UOlWNIgO0ZCLDCfE8JFL8CmdSYio3pTXFMYu7N0bcGlOJdoQa+FCjw4 IVEC2pf3fHxtREvGiByhBJNMm+gmGUmcgTXtlD/e54iMQjycz2yznLUHRGZoKyiYuQUAi6Xu1+ lY//Vl5PxRwzP8dJyJf2fjhryVTv/iXqN4FY+nexBQCq3chRAzTpy83RIoCjJ/uKCXhz6rYczK WJyoKz0qjp1j06VvhgR6TR3Hx5RYeHkq6cqWkMeLn4rSBO2QCnxCrXW5v1mmjg77RYpwALYONU LGq3x2bQXv6bl2vBIhJ+bTVs Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 14 Apr 2019 22:34:02 -0700 IronPort-SDR: IhXF5+woc7bbxo9YrD1E44wYQ0rC1Tld83AOpAbSs68WDEfa3+VHMbUdWlH4mX6ngIxM0wfktQ ZpVxSWmQ2tGQ4RkqDZRcKse1J/DqRwSVzdB0+OfmdSxvWijq/g6bciM49PiaF1KQtZTSF0Oen2 4NFX7BeHiEbxFs/tgW/DYL4yp5K+k40i07OhG3glv75vWQVcs9pWWT6lqjRqDIprvJiPBUx8xt 2fMEm2EF4L9mnTIv4Pfc/fYz5Brld1Ge2nPrJ7Sj/+a6cmRWvAd381pDNq4eDARCF5g1IM5gAy vDI= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip02.wdc.com with ESMTP; 14 Apr 2019 22:57:15 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: Chaitanya Kulkarni Subject: [PATCH 1/2] block: adjust code for get_task_ioprio() Date: Sun, 14 Apr 2019 22:57:02 -0700 Message-Id: <20190415055703.5512-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190415055703.5512-1-chaitanya.kulkarni@wdc.com> References: <20190415055703.5512-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is a preparation patch which adjusts the code and exports get_task_ioprio(). Signed-off-by: Chaitanya Kulkarni --- block/ioprio.c | 20 ++++++++++++++++---- include/linux/ioprio.h | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/block/ioprio.c b/block/ioprio.c index f9821080c92c..9853e9077022 100644 --- a/block/ioprio.c +++ b/block/ioprio.c @@ -156,7 +156,7 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio) return ret; } -static int get_task_ioprio(struct task_struct *p) +static int __get_task_ioprio(struct task_struct *p) { int ret; @@ -172,6 +172,18 @@ static int get_task_ioprio(struct task_struct *p) return ret; } +int get_task_ioprio(struct task_struct *p) +{ + int ret; + + rcu_read_lock(); + ret = __get_task_ioprio(p); + rcu_read_unlock(); + + return ret; +} +EXPORT_SYMBOL_GPL(get_task_ioprio); + int ioprio_best(unsigned short aprio, unsigned short bprio) { if (!ioprio_valid(aprio)) @@ -199,7 +211,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) else p = find_task_by_vpid(who); if (p) - ret = get_task_ioprio(p); + ret = __get_task_ioprio(p); break; case IOPRIO_WHO_PGRP: if (!who) @@ -207,7 +219,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) else pgrp = find_vpid(who); do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { - tmpio = get_task_ioprio(p); + tmpio = __get_task_ioprio(p); if (tmpio < 0) continue; if (ret == -ESRCH) @@ -230,7 +242,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) if (!uid_eq(task_uid(p), user->uid) || !task_pid_vnr(p)) continue; - tmpio = get_task_ioprio(p); + tmpio = __get_task_ioprio(p); if (tmpio < 0) continue; if (ret == -ESRCH) diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h index e9bfe6972aed..1384446c614d 100644 --- a/include/linux/ioprio.h +++ b/include/linux/ioprio.h @@ -90,6 +90,8 @@ extern int ioprio_best(unsigned short aprio, unsigned short bprio); extern int set_task_ioprio(struct task_struct *task, int ioprio); +extern int get_task_ioprio(struct task_struct *p); + #ifdef CONFIG_BLOCK extern int ioprio_check_cap(int ioprio); #else From patchwork Mon Apr 15 05:57:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10900129 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC2141390 for ; Mon, 15 Apr 2019 05:57:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5E612882F for ; Mon, 15 Apr 2019 05:57:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA0E828831; Mon, 15 Apr 2019 05:57:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 538DF2882F for ; Mon, 15 Apr 2019 05:57:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725796AbfDOF5W (ORCPT ); Mon, 15 Apr 2019 01:57:22 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:5613 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725777AbfDOF5W (ORCPT ); Mon, 15 Apr 2019 01:57:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1555307843; x=1586843843; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z3pmJnVNPpm7Vi7lyJ7ODoQa9EmWnw00Z4B16s/OUF4=; b=gDuJ9OM/jubjZpCMUY7Ld5AnLjOPcQBPVXZZ/9XAoHPAzaHao7lqD6T3 nirX2dXTsSG5wbacumn9ysJFeajMMEgBdYRu1vGCLcVd6XuJ/5naYEA6q CrXI67GW/k9InBMBz3rcUr6G8pKnSjR24/dCwGtH2PcQpBPXKz1NHWOnV kVEYamjSo3NFxJmYycFgyKRfPnBBfzULkq1wHlMuwVZ8fYwtfo5g4qPKG 1pITtVNPDtHcQ0UcaWqeowEKuEyW4Oz2C7C8yB5D4ekQFriJOZkPFkouw hw1niJBbqEVrMBBahkAujlYFK647hi3fWB0GGTvQTejFooQoOK7KS+Bri g==; X-IronPort-AV: E=Sophos;i="5.60,352,1549900800"; d="scan'208";a="107710666" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 Apr 2019 13:57:23 +0800 IronPort-SDR: lKqPYoz+NN8WZUt1VS5AGgiozszCf1IZi22ZCAgMl5JeEES6j7axuh5bYIZB9oAOG05rCqvGHp yRELk/+2JVadBV3ZOQ8YrjYd8ndsnth9WsM/BtXpf+aGMGBZpaZKVr8o13ynp6UDUAbxMuVA1q 33ssFOGJNdI0c8EavvSByEpLRP6Cp87Vm4u13HLjb0HFS0b8ehOwMPvy7w/0G6OUMv7c4tsARB HT70ljvPp018O6VWBN9BBkc8dOyLdrJZ1aPvf+viWDh8sSy13qTKKz0Lc1dn/azhzhMyhKvh6q PaMKNg/tYAD8v6pkIijniErl Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 14 Apr 2019 22:34:09 -0700 IronPort-SDR: ZMbPDnYqZsxOJphnSpe3Y6t8UfUPbRyOqAwC31Cu+JCjtaKSIOjgbfucUHLIi8h5OUq2ELU0Gb eAtCu2jcnxmjBe2wkUz3cYmoHN7JqGyM+1XFjYY8bzpfRUGWkMs70nJx+Hap9+4ZJvwlQK/HBq DNQEZ1NHB5sT7wiS+gIW/k601F3WJxfousTo2r25MercRk4oDWNODHWV2mkLVRzt9sjDqC9+LO adG54Zy+oe+cVQ6xla44y1rCpRvQ9FQIMKEViQ2RonBWRowba7gtoQb045BlHuYdb77gZPdiX4 UtI= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip02.wdc.com with ESMTP; 14 Apr 2019 22:57:22 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: Chaitanya Kulkarni Subject: [PATCH 2/2] block: add task priority to init bio iopriority Date: Sun, 14 Apr 2019 22:57:03 -0700 Message-Id: <20190415055703.5512-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190415055703.5512-1-chaitanya.kulkarni@wdc.com> References: <20190415055703.5512-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This uses the current process's ioprioty and initializes the bios issued in the discard, write-zeroes and write-same operations. Signed-off-by: Chaitanya Kulkarni --- block/blk-lib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/blk-lib.c b/block/blk-lib.c index 5f2c429d4378..12c340e7637c 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "blk.h" @@ -64,6 +65,7 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, bio->bi_iter.bi_sector = sector; bio_set_dev(bio, bdev); bio_set_op_attrs(bio, op, 0); + bio_set_prio(bio, get_task_ioprio(current)); bio->bi_iter.bi_size = req_sects << 9; sector += req_sects; @@ -162,6 +164,7 @@ static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector, bio->bi_io_vec->bv_offset = 0; bio->bi_io_vec->bv_len = bdev_logical_block_size(bdev); bio_set_op_attrs(bio, REQ_OP_WRITE_SAME, 0); + bio_set_prio(bio, get_task_ioprio(current)); if (nr_sects > max_write_same_sectors) { bio->bi_iter.bi_size = max_write_same_sectors << 9; @@ -234,6 +237,8 @@ static int __blkdev_issue_write_zeroes(struct block_device *bdev, bio->bi_iter.bi_sector = sector; bio_set_dev(bio, bdev); bio->bi_opf = REQ_OP_WRITE_ZEROES; + bio_set_prio(bio, get_task_ioprio(current)); + if (flags & BLKDEV_ZERO_NOUNMAP) bio->bi_opf |= REQ_NOUNMAP; @@ -286,6 +291,7 @@ static int __blkdev_issue_zero_pages(struct block_device *bdev, bio->bi_iter.bi_sector = sector; bio_set_dev(bio, bdev); bio_set_op_attrs(bio, REQ_OP_WRITE, 0); + bio_set_prio(bio, get_task_ioprio(current)); while (nr_sects != 0) { sz = min((sector_t) PAGE_SIZE, nr_sects << 9);