Re: [PATCH] mm: mmap_lock: fix use-after-free race and css ref leak in tracepoints

2020-12-02 Thread Tejun Heo
Hello, On Wed, Dec 02, 2020 at 03:23:57PM -0800, Shakeel Butt wrote: > > There've been some changes to cgroup ids recently and now cgroup id, ino and > > its file_handle are all compatible. On 64bit ino machines, they're all the > > same and won't be reused. On 32bit ino machines, the lower 32bit

Re: [RFC PATCH] blk-iocost: Optimize the ioc_refreash_vrate() function

2020-12-02 Thread Tejun Heo
On Sun, Nov 29, 2020 at 10:37:18AM +0800, Baolin Wang wrote: > The ioc_refreash_vrate() will only be called in ioc_timer_fn() after > starting a new period or stopping the period. > > So when starting a new period, the variable 'pleft' in ioc_refreash_vrate() > is always the period's time, which m

Re: [PATCH v2 5/5] blk-iocost: Factor out the base vrate change into a separate function

2020-12-02 Thread Tejun Heo
On Thu, Nov 26, 2020 at 04:16:15PM +0800, Baolin Wang wrote: > Factor out the base vrate change code into a separate function > to fimplify the ioc_timer_fn(). > > No functional change. > > Signed-off-by: Baolin Wang Acked-by: Tejun Heo Thanks. -- tejun

Re: [PATCH v2 4/5] blk-iocost: Factor out the active iocgs' state check into a separate function

2020-12-02 Thread Tejun Heo
On Thu, Nov 26, 2020 at 04:16:14PM +0800, Baolin Wang wrote: > Factor out the iocgs' state check into a separate function to > simplify the ioc_timer_fn(). > > No functional change. > > Signed-off-by: Baolin Wang Acked-by: Tejun Heo Thanks. -- tejun

Re: [PATCH v2 3/5] blk-iocost: Move the usage ratio calculation to the correct place

2020-12-02 Thread Tejun Heo
avoid unnecessary calculation for some vtime shortage iocgs. > > Signed-off-by: Baolin Wang Acked-by: Tejun Heo Thanks. -- tejun

Re: [PATCH] blk-throttle: don't check whether or not lower limit is valid if CONFIG_BLK_DEV_THROTTLING_LOW is off

2020-12-02 Thread Tejun Heo
a lot of > time will be wasted to iterate descendants. > > Thus do nothing in blk_throtl_update_limit_valid() in such situation. > > Signed-off-by: Yu Kuai Acked-by: Tejun Heo Thanks. -- tejun

Re: [PATCH] mm: mmap_lock: fix use-after-free race and css ref leak in tracepoints

2020-12-02 Thread Tejun Heo
Hello, On Tue, Dec 01, 2020 at 12:53:46PM -0800, Shakeel Butt wrote: > The writeback tracepoint in include/trace/events/writeback.h is > already using the cgroup IDs. Actually it used to use cgroup_path but > converted to cgroup_ino. > > Tejun, how do you use these tracepoints? There've been som

Re: [PATCH -tip 26/32] sched: Add a second-level tag for nested CGroup usecase

2020-12-02 Thread Tejun Heo
Hello, On Wed, Dec 02, 2020 at 09:02:11AM +0100, Peter Zijlstra wrote: > > the user might only want subsets of {B, C, D, E} to share. For > > instance, the user might only want {B,C} and {D, E} to share. One way > > to solve this would be to allow the user to write the group cookie > > directly.

Re: [PATCH 2/2] kernfs: remove mutex in kernfs_dop_revalidate

2020-12-02 Thread Tejun Heo
Hello, On Wed, Dec 02, 2020 at 10:58:37PM +0800, Fox Chen wrote: > There is a big mutex in kernfs_dop_revalidate which slows down the > concurrent performance of kernfs. > > Since kernfs_dop_revalidate only does some checks, the lock is > largely unnecessary. Also, according to kernel filesystem

Re: [PATCH 1/2] kernfs: replace the mutex in kernfs_iop_permission with a rwlock

2020-12-02 Thread Tejun Heo
On Wed, Dec 02, 2020 at 10:58:36PM +0800, Fox Chen wrote: > diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h > index 89f6a4214a70..545cdb39b34b 100644 > --- a/include/linux/kernfs.h > +++ b/include/linux/kernfs.h > @@ -156,6 +156,7 @@ struct kernfs_node { > unsigned short

Re: [PATCH 1/2] kernfs: replace the mutex in kernfs_iop_permission with a rwlock

2020-12-02 Thread Tejun Heo
Hello, On Wed, Dec 02, 2020 at 10:58:36PM +0800, Fox Chen wrote: > @@ -121,7 +121,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct > iattr *iattr) > if (!kn) > return -EINVAL; > > - mutex_lock(&kernfs_mutex); > + write_lock(&kn->iattr_rwlock); > error

Re: [PATCH 4/7] blk-iocost: Add a flag to indicate if need update hwi

2020-11-25 Thread Tejun Heo
On Wed, Nov 25, 2020 at 10:15:38PM +0800, Baolin Wang wrote: > > > Hello, > > > > On Tue, Nov 24, 2020 at 11:33:33AM +0800, Baolin Wang wrote: > > > @@ -1445,7 +1447,8 @@ static void iocg_kick_waitq(struct ioc_gq *iocg, > > > bool pay_debt, > > >* after the above debt payment. > > >

Re: [RFC PATCH] workqueue: Add support for exposing singlethread workqueues in sysfs

2020-11-25 Thread Tejun Heo
Hello, This generally looks fine to me. Some nits below. On Tue, Oct 06, 2020 at 03:06:07PM +0300, Tariq Toukan wrote: > @@ -432,6 +433,9 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, > WQ_MEM_RECLAIM, 1, (name)) > #define create_singlethread_workqueue(name)

Re: [PATCH] cgroup/cgroup.c: replace 'of->kn->priv' with of_cft()

2020-11-25 Thread Tejun Heo
On Fri, Nov 06, 2020 at 10:47:40PM +0800, Hui Su wrote: > we have supplied the inline function: of_cft() in cgroup.h. > > So replace the direct use 'of->kn->priv' with inline func > of_cft(), which is more readable. > > Signed-off-by: Hui Su Applied to cgroup/for-5.10-fixes. Thanks. -- tejun

Re: [PATCH] Docs/cgroup: update the cgroup-v1 docs

2020-11-25 Thread Tejun Heo
On Mon, Nov 02, 2020 at 11:21:16PM +0800, Hui Su wrote: > Since 'commit 69d0206c793a ("cgroup: bring some sanity to > naming around cg_cgroup_link")', 'cg_cgroup_link' has been > changed to 'cgrp_cset_link'. > so as its element 'cgrp_link_list' and 'cg_link_list'. > > Since commit 47cfcd092245 ("c

Re: [PATCH] kernel: cgroup: Mundane spelling fixes throughout the file

2020-11-25 Thread Tejun Heo
On Mon, Nov 09, 2020 at 04:01:11PM +0530, Bhaskar Chowdhury wrote: > Few spelling fixes throughout the file. > > Signed-off-by: Bhaskar Chowdhury Applied to cgroup/for-5.10-fixes. Thanks. -- tejun

Re: [RFC PATCH] blk-cgroup: prevent rcu_sched detected stalls warnings in blkg_destroy_all()

2020-11-25 Thread Tejun Heo
Hello, On Wed, Nov 25, 2020 at 08:49:19PM +0800, yukuai (C) wrote: > > You can't continue iteration after dropping both locks. You'd have to jump > > out of loop and start list_for_each_entry_safe() again. > > Thanks for your review, it's right. On the other hand > blkcg_activate_policy() and blk

Re: [PATCH] fs/kernfs: remove the double check of dentry->inode

2020-11-25 Thread Tejun Heo
On Fri, Nov 13, 2020 at 09:21:43PM +0800, Hui Su wrote: > In both kernfs_node_from_dentry() and in > kernfs_dentry_node(), we will check the dentry->inode > is NULL or not, which is superfluous. > > So remove the check in kernfs_node_from_dentry(). > > Signed-off-by: Hui

Re: [PATCH v2] workqueue: Kick a worker based on the actual activation of delayed works

2020-11-25 Thread Tejun Heo
On Thu, Nov 19, 2020 at 02:21:25PM +0800, Yunfeng Ye wrote: > In realtime scenario, We do not want to have interference on the > isolated cpu cores. but when invoking alloc_workqueue() for percpu wq > on the housekeeping cpu, it kick a kworker on the isolated cpu. > > alloc_workqueue > pwq_a

Re: [RFC PATCH] blk-cgroup: prevent rcu_sched detected stalls warnings in blkg_destroy_all()

2020-11-25 Thread Tejun Heo
Hello, Thanks for the fix. A couple comments below. On Sat, Nov 21, 2020 at 04:34:20PM +0800, Yu Kuai wrote: > +#define BLKG_DESTROY_BATH 4096 I think you meant BLKG_DESTROY_BATCH. > static void blkg_destroy_all(struct request_queue *q) > { > struct blkcg_gq *blkg, *n; > + int count

Re: [PATCH 7/7] blk-iocost: Factor out the base vrate change into a separate function

2020-11-25 Thread Tejun Heo
Hello, On Tue, Nov 24, 2020 at 11:33:36AM +0800, Baolin Wang wrote: > @@ -2320,45 +2358,11 @@ static void ioc_timer_fn(struct timer_list *timer) > ioc->busy_level = clamp(ioc->busy_level, -1000, 1000); > > if (ioc->busy_level > 0 || (ioc->busy_level < 0 && !nr_lagging)) { > -

Re: [PATCH 6/7] blk-iocost: Factor out the active iocgs' state check into a separate function

2020-11-25 Thread Tejun Heo
Hello, On Tue, Nov 24, 2020 at 11:33:35AM +0800, Baolin Wang wrote: > -static void ioc_timer_fn(struct timer_list *timer) > +/* > + * Waiters determine the sleep durations based on the vrate they > + * saw at the time of sleep. If vrate has increased, some waiters > + * could be sleeping for too

Re: [PATCH 5/7] blk-iocost: Move the usage ratio calculation to the correct place

2020-11-25 Thread Tejun Heo
Hello, > @@ -2225,6 +2207,25 @@ static void ioc_timer_fn(struct timer_list *timer) >time_before64(vtime, now.vnow - ioc->margins.low))) { > u32 hwa, old_hwi, hwm, new_hwi; > > + if (vdone != vtime) { > + u64

Re: [PATCH 4/7] blk-iocost: Add a flag to indicate if need update hwi

2020-11-25 Thread Tejun Heo
Hello, On Tue, Nov 24, 2020 at 11:33:33AM +0800, Baolin Wang wrote: > @@ -1445,7 +1447,8 @@ static void iocg_kick_waitq(struct ioc_gq *iocg, bool > pay_debt, >* after the above debt payment. >*/ > ctx.vbudget = vbudget; > - current_hweight(iocg, NULL, &ctx.hw_inuse); > +

Re: [PATCH 3/7] blk-iocost: Just open code the q_name()

2020-11-25 Thread Tejun Heo
On Tue, Nov 24, 2020 at 11:33:32AM +0800, Baolin Wang wrote: > The simple q_name() function is only called from ioc_name(), > just open code it to make code more readable. > > Signed-off-by: Baolin Wang I'm not sure this is an improvement. Either way seems fine to me. So, why change? Thanks. -

Re: [PATCH 1/7] blk-iocost: Fix some typos in comments

2020-11-25 Thread Tejun Heo
On Tue, Nov 24, 2020 at 11:33:30AM +0800, Baolin Wang wrote: > Fix some typos in comments. > > Signed-off-by: Baolin Wang Acked-by: Tejun Heo -- tejun

Re: [PATCH 2/7] blk-iocost: Remove unnecessary advance declaration

2020-11-25 Thread Tejun Heo
On Tue, Nov 24, 2020 at 11:33:31AM +0800, Baolin Wang wrote: > Remove unnecessary advance declaration of struct ioc_gq. > > Signed-off-by: Baolin Wang Acked-by: Tejun Heo -- tejun

Re: [PATCH] trace: fix potenial dangerous pointer

2020-11-24 Thread Tejun Heo
%s", __entry->name) > > after the strncpy(). > > Acked-by: Steven Rostedt (VMware) > > This should go through the tree that has the code that uses these > tracepoints. Acked-by: Tejun Heo Andrew, can you please route this one? Thanks. -- tejun

Re: [PATCH 03/27] blk-iocost: use local[64]_t for percpu stat

2020-11-20 Thread Tejun Heo
Hello, On Sat, Nov 21, 2020 at 06:51:47AM +0900, Stafford Horne wrote: > FYI, I am just noticing this but this breaks my allyesconfig build > on OpenRISC; as 32-bit arch/openrisc doesn't define local64.h > > In general local64 is slow on 32-bit architectures, would that > be a problem with the us

Re: [PATCH v2] cpuset: fix race between hotplug work and later CPU offline

2020-11-13 Thread Tejun Heo
Hello, On Fri, Nov 13, 2020 at 09:16:22AM +0100, Peter Zijlstra wrote: > Works for me. TJ, do I take this or do you want it in the cgroup tree? > > In that case: > > Acked-by: Peter Zijlstra (Intel) Please take it through the sched tree, and FWIW Acked-by: Tejun Heo Thank you. -- tejun

Re: [PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-26 Thread Tejun Heo
Hello, Petr. On Mon, Oct 26, 2020 at 05:45:55PM +0100, Petr Mladek wrote: > > I don't think this works. The kthread may have changed its binding while > > running using set_cpus_allowed_ptr() as you're doing above. Besides, when a > > cpu goes offline, the bound kthread can fall back to other cpus

Re: [PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-26 Thread Tejun Heo
On Mon, Oct 26, 2020 at 02:52:13PM +0800, qiang.zh...@windriver.com wrote: > @@ -737,8 +741,11 @@ __kthread_create_worker(int cpu, unsigned int flags, > if (IS_ERR(task)) > goto fail_task; > > - if (cpu >= 0) > + if (cpu >= 0) { > kthread_bind(task, cpu);

Re: [PATCH] workqueue: replace call_rcu with kfree_rcu

2020-10-26 Thread Tejun Heo
On Wed, Oct 14, 2020 at 04:31:45PM +0800, qiang.zh...@windriver.com wrote: > diff --git a/kernel/workqueue.c b/kernel/workqueue.c > index ac088ce6059b..8d4fe649631a 100644 > --- a/kernel/workqueue.c > +++ b/kernel/workqueue.c > @@ -3653,11 +3653,6 @@ static struct worker_pool *get_unbound_pool(cons

Re: [PATCH] kernfs: bring names in comments in line with code

2020-10-19 Thread Tejun Heo
On Thu, Oct 15, 2020 at 02:57:26PM -0400, Willem de Bruijn wrote: > From: Willem de Bruijn > > Fix two stragglers in the comments of the below rename operation. > > Fixes: adc5e8b58f48 ("kernfs: drop s_ prefix from kernfs_node members") > Signed-off-by: Willem de

[ANNOUNCEMENT] resctl-demo (Resource Control Demo)

2020-10-15 Thread Tejun Heo
Hello, resctl-demo which documents resource control features and strategies with live scenarios has just been released. This documents most stuff that we learned at FB working with and deploying cgroup2, PSI and oomd. Setting up the whole environment is still a bit difficult because it depends on

[GIT PULL] cgroup changes for v5.10-rc1

2020-10-13 Thread Tejun Heo
Hello, Linus. Two minor changes. One makes cgroup interface files ignore 0 sized writes rather than triggering -EINVAL on them. The other change is a cleanup which doesn't cause any behavior changes. Thanks. The following changes since commit 02de58b24d2e1b2cf947d57205bd2221d897193c: Merge ta

Re: [PATCH -v2 05/17] workqueue: Manually break affinity on hotplug

2020-10-05 Thread Tejun Heo
On Mon, Oct 05, 2020 at 04:57:22PM +0200, Peter Zijlstra wrote: > Don't rely on the scheduler to force break affinity for us -- it will > stop doing that for per-cpu-kthreads. > > Signed-off-by: Peter Zijlstra (Intel) Acked-by: Tejun Heo Thanks. -- tejun

Re: [PATCH V7 1/2] percpu_ref: reduce memory footprint of percpu_ref in fast path

2020-10-01 Thread Tejun Heo
Kabatova > Reviewed-by: Christoph Hellwig > Cc: Sagi Grimberg > Cc: Tejun Heo > Cc: Christoph Hellwig > Cc: Jens Axboe > Cc: Bart Van Assche > Signed-off-by: Ming Lei Acked-by: Tejun Heo Thanks. -- tejun

Re: RFC: sort out get_gendisk abuses

2020-09-30 Thread Tejun Heo
Hello, Christoph. On Fri, Sep 25, 2020 at 06:14:45PM +0200, Christoph Hellwig wrote: > this series tries to remove two abuses of the get_gendisk API. > The first one is fairly straigt forward and switched the blk-cgroup > configuration API to properly open the block device, but I'd love to see > i

Re: [PATCH] cgroup: remove redundant kernfs_activate in cgroup_setup_root()

2020-09-30 Thread Tejun Heo
On Fri, Sep 25, 2020 at 05:11:10PM +0800, Wei Yang wrote: > This step is already done in rebind_subsystems(). > > Not necessary to do it again. > > Signed-off-by: Wei Yang Applied to cgroup/for-5.10. Thanks. -- tejun

Re: [PATCH V6 1/2] percpu_ref: reduce memory footprint of percpu_ref in fast path

2020-09-30 Thread Tejun Heo
On Wed, Sep 30, 2020 at 04:26:56PM +0800, Ming Lei wrote: > diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h > index 87d8a38bdea1..1d6ed9ca23dd 100644 > --- a/include/linux/percpu-refcount.h > +++ b/include/linux/percpu-refcount.h > @@ -92,18 +92,23 @@ enum { > P

Re: [PATCH v4 49/52] workqueue: fix a kernel-doc warning

2020-09-30 Thread Tejun Heo
markups. > > Signed-off-by: Mauro Carvalho Chehab Acked-by: Tejun Heo Please route however you see fit. Thanks. -- tejun

Re: [PATCH v3] kthread_worker: Prevent queuing delayed work from timer_fn when it is being canceled

2020-09-30 Thread Tejun Heo
t_work(); > > BUG: kthread_insert_work() should not get called when work->canceling > is set. > > Reviewed-by: Petr Mladek > Signed-off-by: Zqiang Acked-by: Tejun Heo This prolly should go throgh -mm. Can you please also add a stable: tag? Thanks. -- tejun

Re: sched: rq->nr_iowait transiently going negative after the recent p->on_cpu optimization

2020-09-24 Thread Tejun Heo
On Thu, Sep 24, 2020 at 04:50:41PM +0200, Peter Zijlstra wrote: > > Rik suggested that it'd be sufficient to return 0 on underflow especially > > given that 0 is actually the right number to describe the state. So, maybe > > that can be a nicer code-wise? > > I worry about things where one CPU has

Re: sched: rq->nr_iowait transiently going negative after the recent p->on_cpu optimization

2020-09-24 Thread Tejun Heo
Hello, On Thu, Sep 24, 2020 at 01:50:42PM +0200, Peter Zijlstra wrote: > Hurmph.. I suppose you're right :/ And this is an actual problem? Yeah, this got exposed to userspace as a full 64bit number which overflowed u32 conversion in the rust procfs library which aborted a program I was working on

Re: [PATCH] cgroup: Add cgroupstats numbers to cgroup.stat file

2020-09-21 Thread Tejun Heo
Hello, On Tue, Sep 15, 2020 at 11:53:49PM +0800, Chengming Zhou wrote: > In the cgroup v1, we can use netlink interface to get cgroupstats for > a cgroup. But it has been excluded from cgroup v2 interface intentionally > due to the duplication and inconsistencies with other statistics. > To make c

Re: [PATCH 1/4] mm: Trial do_wp_page() simplification

2020-09-21 Thread Tejun Heo
Hello, On Mon, Sep 21, 2020 at 04:28:34PM +0200, Michal Hocko wrote: > Fundamentaly CLONE_INTO_CGROUP is similar to regular fork + move to the > target cgroup after the child gets executed. So in principle there > shouldn't be any big difference. Except that the move has to be explicit > and the t

Re: [PATCH 0/3] drm: commit_work scheduling

2020-09-21 Thread Tejun Heo
Hello, On Mon, Sep 21, 2020 at 11:21:54AM +0200, Daniel Vetter wrote: > The part I don't like about this is that it all feels rather hacked > together, and if we add more stuff (or there's some different thing in the > system that also needs rt scheduling) then it doesn't compose. > > So question

[PATCH 6/5] iocost: consider iocgs with active delays for debt forgiveness

2020-09-18 Thread Tejun Heo
state transitions. Signed-off-by: Tejun Heo --- Jens, a follow up patch to the series. The git tree is also updated. Thanks. block/blk-iocost.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2048,7 +2048,7 @@ static

sched: rq->nr_iowait transiently going negative after the recent p->on_cpu optimization

2020-09-18 Thread Tejun Heo
Hello, Peter, I noticed /proc/stat::procs_blocked going U64_MAX transiently once in the blue moon without any other persistent issues. After looking at the code with Rik for a bit, the culprit seems to be c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu") - it changed where ttwu de

[PATCH 4/5] iocost: reimplement debt forgiveness using average usage

2020-09-17 Thread Tejun Heo
debt forgivness a lot more effective at reducing the amount of unnecessary idleness. * Constants are renamed with DFGV_ prefix. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 94 ++ 1 file changed, 69 insertions(+), 25 deletions(-) diff --git a

[PATCH 5/5] iocost: add iocg_forgive_debt tracepoint

2020-09-17 Thread Tejun Heo
Signed-off-by: Tejun Heo --- block/blk-iocost.c| 12 ++ include/trace/events/iocost.h | 41 +++ 2 files changed, 53 insertions(+) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 9b1f94499432..328ae805e85f 100644 --- a/block/blk

[PATCH 2/5] iocost: replace nr_shortages cond in ioc_forgive_debts() with busy_level one

2020-09-17 Thread Tejun Heo
t with ioc->busy_level based condition so that we block debt reduction when the underlying device is being saturated. ioc_forgive_debts() call is moved after busy_level determination. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-

[PATCHSET for-5.10/block] iocost: improve debt forgiveness logic

2020-09-17 Thread Tejun Heo
Hello, Debt reduction logic was recently added by dda1315f1853 ("blk-iocost: halve debts if device stays idle"). While it was effective at avoiding pathological cases where some iocgs were kept delayed while the device was most idle, it wasn't very effective at addressing more complex conditions a

[PATCH 3/5] iocost: recalculate delay after debt reduction

2020-09-17 Thread Tejun Heo
ecessary idling. Reset iocg->delay to 0 after debt reduction so that iocg_kick_waitq() recalculates new delay value based on the reduced debt amount. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/

[PATCH 1/5] iocost: factor out ioc_forgive_debts()

2020-09-17 Thread Tejun Heo
Debt reduction logic is going to be improved and expanded. Factor it out into ioc_forgive_debts() and generalize the comment a bit. No functional change. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 66 -- 1 file changed, 35 insertions(+), 31

[PATCH block/for-next] iocost: fix infinite loop bug in adjust_inuse_and_calc_cost()

2020-09-14 Thread Tejun Heo
o before acquiring ioc->lock. When this happens, the adj_step is calculated as zero and the incremental adjustment loop becomes an infinite one. Fix it by fetching the active weight after acquiring ioc->lock. Signed-off-by: Tejun Heo Fixes: b0853ab4a238 ("blk-iocost: revamp in-period

Re: [PATCH v2 block/for-next] blk-iocost: fix divide-by-zero in transfer_surpluses()

2020-09-11 Thread Tejun Heo
On Fri, Sep 11, 2020 at 04:43:18PM -0600, Jens Axboe wrote: > On 9/11/20 4:40 PM, Tejun Heo wrote: > > Conceptually, root_iocg->hweight_donating must be less than WEIGHT_ONE but > > all hweight calculations round up and thus it may end up >= WEIGHT_ONE > > triggeri

[PATCH v2 block/for-next] blk-iocost: fix divide-by-zero in transfer_surpluses()

2020-09-11 Thread Tejun Heo
Conceptually, root_iocg->hweight_donating must be less than WEIGHT_ONE but all hweight calculations round up and thus it may end up >= WEIGHT_ONE triggering divide-by-zero and other issues. Bound the value to avoid surprises. Signed-off-by: Tejun Heo Fixes: e08d02aa5fc9 ("blk-iocost

[PATCH block/for-next] blk-iocost: fix divide-by-zero in transfer_surpluses()

2020-09-11 Thread Tejun Heo
Conceptually, root_iocg->hweight_donating must be less than WEIGHT_ONE but all hweight calculations round up and thus it may end up >= WEIGHT_ONE triggering divide-by-zero and other issues. Bound the value to avoid surprises. Signed-off-by: Tejun Heo Fixes: e08d02aa5fc9 ("blk-iocost

Re: [PATCH] taskstats: fix CGROUPSTATS_CMD_GET for cgroup v2

2020-09-10 Thread Tejun Heo
On Thu, Sep 10, 2020 at 01:52:07PM +0800, Chengming Zhou wrote: > We found cgroupstats_build would return -EINVAL when using netlink > CGROUPSTATS_CMD_GET interface to get stats on cgroup v2. Fix it by > supporting cgroup v2 kernfs directory in cgroupstats_build, and export > cgroup2_fs_type like w

Re: [PATCH] blkcg: add plugging support for punt bio

2020-09-08 Thread Tejun Heo
On Sat, Sep 05, 2020 at 11:25:03AM +, Tianxianting wrote: > Hi jens,tj > Could you share a couple of minutes to comment it? > I really appreciate it The result looks fine to me but can you please summarize that in the commit message of the patch? Thanks. -- tejun

Re: [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker

2020-09-04 Thread Tejun Heo
On Mon, Jul 27, 2020 at 08:29:29PM +0800, linmiaohe wrote: > From: Miaohe Lin > > Use wrapper function wake_up_worker() to wake up first idle worker. > > Signed-off-by: Miaohe Lin Applied to wq/for-5.10. Thanks. -- tejun

Re: [PATCH v4] workqueue: Warn when work flush own workqueue

2020-09-04 Thread Tejun Heo
On Thu, Aug 27, 2020 at 02:09:11PM +0800, Qianli Zhao wrote: > @@ -2594,13 +2595,17 @@ static void check_flush_dependency(struct > workqueue_struct *target_wq, > struct work_struct *target_work) > { > work_func_t target_func = target_work ? target_work->func

Re: [PATCH v3 2/6] workqueue: kasan: record workqueue stack

2020-09-02 Thread Tejun Heo
rco Elver > Cc: Andrey Ryabinin > Cc: Dmitry Vyukov > Cc: Alexander Potapenko > Cc: Tejun Heo > Cc: Lai Jiangshan Acked-by: Tejun Heo Thanks. -- tejun

Re: [PATCH] writeback: clear auto_free in initializaiton

2020-09-02 Thread Tejun Heo
Hello, On Wed, Aug 26, 2020 at 06:11:26PM +0200, Jan Kara wrote: > > Which seems like a strange place to set auto_free as > > it is not where the rest of base_work is initialized. > > Otherwise I agree it's a strange place. I've added Tejun to CC just in case > he remembers why he's added that.

[PATCH 07/27] blk-iocost: make iocg_kick_waitq() call iocg_kick_delay() after paying debt

2020-09-01 Thread Tejun Heo
t occur by making iocg_kick_waitq() always call iocg_kick_delay() after paying debt. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index ac22d761a350..b2b8dfbeee5a 100644 --- a/block/blk-ioco

[PATCHSET for-5.10/block] blk-iocost: iocost: improve donation, debt and excess handling

2020-09-01 Thread Tejun Heo
Hello, This patchset improves iocost in three areas to make iocost internal operations more accurate and immediate with the goal of improving work conservation and distribution fairness, and removing dependence on vrate adjustments for masking work conservation issues. This improves overall contro

[PATCH 01/27] blk-iocost: ioc_pd_free() shouldn't assume irq disabled

2020-09-01 Thread Tejun Heo
ioc_pd_free() grabs irq-safe ioc->lock without ensuring that irq is disabled when it can be called with irq disabled or enabled. This has a small chance of causing A-A deadlocks and triggers lockdep splats. Use irqsave operations instead. Signed-off-by: Tejun Heo Fixes: 7caa47151ab2 (&qu

[PATCH 11/27] blk-iocost: streamline vtime margin and timer slack handling

2020-09-01 Thread Tejun Heo
is expected. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 67 ++ 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index dc72cd965837..f36988657594 100644 --- a/block/blk-iocost.c +++ b/block/blk

[PATCH 10/27] blk-iocost: make ioc_now->now and ioc->period_at 64bit

2020-09-01 Thread Tejun Heo
They are in microseconds and wrap in around 1.2 hours with u32. While unlikely, confusions from wraparounds are still possible. We aren't saving anything meaningful by keeping these u32. Let's make them u64. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 4 ++-- 1 file changed, 2

[PATCH 06/27] blk-iocost: move iocg_kick_delay() above iocg_kick_waitq()

2020-09-01 Thread Tejun Heo
We'll make iocg_kick_waitq() call iocg_kick_delay(). Reorder them in preparation. This is pure code reorganization. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 120 ++--- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/bloc

[PATCH 02/27] blk-stat: make q->stats->lock irqsafe

2020-09-01 Thread Tejun Heo
blk-iocost calls blk_stat_enable_accounting() while holding an irqsafe lock which triggers a lockdep splat because q->stats->lock isn't irqsafe. Let's make it irqsafe. Signed-off-by: Tejun Heo Fixes: cd006509b0a9 ("blk-iocost: account for IO size when testin

[PATCH 23/27] blk-iocost: halve debts if device stays idle

2020-09-01 Thread Tejun Heo
extreme cases without impacting regular operation by forgiving debts too readily. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 49 +- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index

[PATCH 25/27] blk-iocost: restore inuse update tracepoints

2020-09-01 Thread Tejun Heo
Update and restore the inuse update tracepoints. Signed-off-by: Tejun Heo --- block/blk-iocost.c| 16 include/trace/events/iocost.h | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index

[PATCH 27/27] blk-iocost: update iocost_monitor.py

2020-09-01 Thread Tejun Heo
iocost went through significant internal changes. Update iocost_monitor.py accordingly. Signed-off-by: Tejun Heo --- tools/cgroup/iocost_monitor.py | 54 -- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/tools/cgroup/iocost_monitor.py b/tools

[PATCH 26/27] blk-iocost: add three debug stat - cost.wait, indebt and indelay

2020-09-01 Thread Tejun Heo
These are really cheap to collect and can be useful in debugging iocost behavior. Add them as debug stats for now. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 77 +++--- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/block/blk

[PATCH 04/27] blk-iocost: rename propagate_active_weights() to propagate_weights()

2020-09-01 Thread Tejun Heo
It already propagates two weights - active and inuse - and there will be another soon. Let's drop the confusing misnomers. Rename [__]propagate_active_weights() to [__]propagate_weights() and commit_active_weights() to commit_weights(). This is pure rename. Signed-off-by: Tejun Heo ---

[PATCH 22/27] blk-iocost: implement delay adjustment hysteresis

2020-09-01 Thread Tejun Heo
er_fn() and the dedicated hrtimer is removed. Signed-off-by: Tejun Heo Cc: Josef Bacik --- block/blk-cgroup.c | 23 ++--- block/blk-iocost.c | 119 ++--- 2 files changed, 86 insertions(+), 56 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk

[PATCH 19/27] blk-iocost: revamp donation amount determination

2020-09-01 Thread Tejun Heo
he right solution is assigning appropriate costs for such IOs. This significantly improves the donation determination logic while also simplifying it. Now all donations are immediate, exact and smooth. Signed-off-by: Tejun Heo Cc: Andy Newell --- block/blk-iocost.c | 133 +---

[PATCH 13/27] blk-iocost: add absolute usage stat

2020-09-01 Thread Tejun Heo
at collection and flushing employ the same method as cgroup rstat on the active iocg's and the only hot path overhead is preemption toggling and adding to a percpu counter. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 155 +++-- 1 file changed, 14

[PATCH 14/27] blk-iocost: calculate iocg->usages[] from iocg->local_stat.usage_us

2020-09-01 Thread Tejun Heo
of the current hierarchical inuse weight. Signed-off-by: Tejun Heo --- block/blk-iocost.c| 72 ++- include/trace/events/iocost.h | 7 +--- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c inde

[PATCH 20/27] blk-iocost: revamp in-period donation snapbacks

2020-09-01 Thread Tejun Heo
of scaling inuse on weight changes isn't clear. Removed inuse scaling from weight_update(). Signed-off-by: Tejun Heo --- block/blk-iocost.c | 133 - 1 file changed, 96 insertions(+), 37 deletions(-) diff --git a/block/blk-iocost.c b/blo

[PATCH 24/27] blk-iocost: implement vtime loss compensation

2020-09-01 Thread Tejun Heo
period matches what got lost. This significantly improves work conservation when involving high weight cgroups with intermittent and bursty IO patterns. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 132 ++--- 1 file changed, 90 insertions(+), 42 deletions

[PATCH 18/27] blk-iocost: implement Andy's method for donation weight updates

2020-09-01 Thread Tejun Heo
nsfer_surpluses(). This makes the donation calculations accurate per cycle and enables further improvements in other parts of the donation logic. Signed-off-by: Tejun Heo Cc: Andy Newell --- block/blk-iocost.c | 252 +++-- 1 file changed, 244 insertions(+), 8 delet

[PATCH 21/27] blk-iocost: revamp debt handling

2020-09-01 Thread Tejun Heo
is likely needs further improvements in the future. * iocg_rqos_merge() now calls blkcg_schedule_throttle() as necessary. Signed-off-by: Tejun Heo Cc: Andy Newell --- block/blk-iocost.c | 117 +++-- 1 file changed, 93 insertions(+), 24 deletions(-) diff --g

[PATCH 16/27] blk-iocost: decouple vrate adjustment from surplus transfers

2020-09-01 Thread Tejun Heo
;t be necessary with the scheduled rewrite of donation mechanism which will make it precise and immediate. Let's decouple the two in preparation. Signed-off-by: Tejun Heo --- block/blk-iocost.c| 19 +++ include/trace/events/iocost.h | 13 - 2 files c

[PATCH 15/27] blk-iocost: replace iocg->has_surplus with ->surplus_list

2020-09-01 Thread Tejun Heo
Instead of marking iocgs with surplus with a flag and filtering for them while walking all active iocgs, build a surpluses list. This doesn't make much difference now but will help implementing improved donation logic which will iterate iocgs with surplus multiple times. Signed-off-by: Teju

[PATCH 17/27] blk-iocost: restructure surplus donation logic

2020-09-01 Thread Tejun Heo
ly to have severely negative implications and the whole logic will be revamped soon. This patch also removes two tracepoints. The existing TPs don't quite fit the new implementation. A later patch will update and reinstate them. Signed-off-by: Tejun Heo --- block/blk-ioco

[PATCH 12/27] blk-iocost: grab ioc->lock for debt handling

2020-09-01 Thread Tejun Heo
ontain references to future changes. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 92 -- 1 file changed, 73 insertions(+), 19 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index f36988657594..23b173e34591 100644 --- a/block/blk-

[PATCH 05/27] blk-iocost: clamp inuse and skip noops in __propagate_weights()

2020-09-01 Thread Tejun Heo
ither active or inuse is changed. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 78e6919153d8..8dfe73dde2a8 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -897,7 +8

[PATCH 08/27] blk-iocost: s/HWEIGHT_WHOLE/WEIGHT_ONE/g

2020-09-01 Thread Tejun Heo
We're gonna use HWEIGHT_WHOLE for regular weights too. Let's rename it to WEIGHT_ONE. Pure rename. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-ioco

[PATCH 09/27] blk-iocost: use WEIGHT_ONE based fixed point number for weights

2020-09-01 Thread Tejun Heo
To improve weight donations, we want to able to scale inuse with a greater accuracy and down below 1. Let's make non-hierarchical weights to use WEIGHT_ONE based fixed point numbers too like hierarchical ones. This doesn't cause any behavior changes yet. Signed-off-by: Tejun Heo ---

[PATCH 03/27] blk-iocost: use local[64]_t for percpu stat

2020-09-01 Thread Tejun Heo
blk-iocost has been reading percpu stat counters from remote cpus which on some archs can lead to torn reads in really rare occassions. Use local[64]_t for those counters. Signed-off-by: Tejun Heo --- block/blk-iocost.c | 37 +++-- 1 file changed, 27 insertions

Re: [GIT PULL] x86/mm changes for v5.9

2020-08-06 Thread Tejun Heo
On Thu, Aug 06, 2020 at 12:42:23PM -0700, Linus Torvalds wrote: > that admittedly odd sequence is get_work_pwq(work) > > And then the faulting instruction is: > > > 2a:* 49 8b 46 08 mov0x8(%r14),%rax <-- trapping instruction > > and this is the "->wq" dereference. > > So it's the

Re: [PATCH] blkcg: add plugging support for punt bio

2020-08-06 Thread Tejun Heo
On Thu, Aug 06, 2020 at 09:54:42AM -0400, Xianting Tian wrote: > Try to merge continuous bio to current task's plug fisrt. > > Signed-off-by: Xianting Tian Acked-by: Tejun Heo Thanks! -- tejun

Re: [PATCH] iocost: Only inc nr_shortages when have io waited

2020-08-04 Thread Tejun Heo
On Sun, Aug 02, 2020 at 01:00:21AM +0800, Chengming Zhou wrote: > The last else branch of current code may have not io waited in iocg, > in which case we should not inc nr_shortages, or the device vrate > will speed up even this iocg is not shortage of vtime. > > Signed-off-by: Chengming Zhou > -

Re: [PATCH] iocost_monitor: start from the oldest usage index

2020-07-30 Thread Tejun Heo
On Thu, Jul 30, 2020 at 08:31:04PM +0800, Chengming Zhou wrote: > iocg usage_idx is the latest usage index, we should start from the > oldest usage index to show the consecutive NR_USAGE_SLOTS usages. > > Signed-off-by: Chengming Zhou Acked-by: Tejun Heo Thanks. -- tejun

Re: [PATCH] iocost: Fix check condition of iocg abs_vdebt

2020-07-30 Thread Tejun Heo
Hello, On Thu, Jul 30, 2020 at 05:03:21PM +0800, Chengming Zhou wrote: > We shouldn't skip iocg when its abs_vdebt is not zero. > > Fixes: 0b80f9866e6b ("iocost: protect iocg->abs_vdebt with > iocg->waitq.lock") > > Signed-off-by: Chengming Zhou Acked-by: Tejun Heo Thanks. -- tejun

Re: [PATCH v3] kthread: Work could not be queued when worker being destroyed

2020-07-06 Thread Tejun Heo
On Sun, Jul 05, 2020 at 09:30:18AM +0800, qiang.zh...@windriver.com wrote: > From: Zhang Qiang > > Before the work is put into the queue of the worker thread, > the state of the worker thread needs to be detected,because > the worker thread may be in the destruction state at this time. > > Signe

<    1   2   3   4   5   6   7   8   9   10   >