Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce ZFS related processes/tasks #118

Closed
devsk opened this issue Feb 23, 2011 · 13 comments
Closed

Reduce ZFS related processes/tasks #118

devsk opened this issue Feb 23, 2011 · 13 comments
Labels
Type: Feature Feature request or new feature
Milestone

Comments

@devsk
Copy link

devsk commented Feb 23, 2011

These are apart from the worker threads.

# ps|grep "\[z"
root      2710     2  0 Feb22 ?        00:00:00      0       0   0 S zvol/0          [zvol/0]
root      2711     2  0 Feb22 ?        00:00:00      0       0   0 S zvol/1          [zvol/1]
root      2712     2  0 Feb22 ?        00:00:00      0       0   0 S zvol/2          [zvol/2]
root      2713     2  0 Feb22 ?        00:00:00      0       0   0 S zvol/3          [zvol/3]
root      3073     2  0 Feb22 ?        00:00:00      0       0   0 S z_null_iss/0    [z_null_iss/0]
root      3074     2  0 Feb22 ?        00:00:00      0       0   0 S z_null_int/0    [z_null_int/0]
root      3075     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_iss/0      [z_rd_iss/0]
root      3076     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_iss/1      [z_rd_iss/1]
root      3077     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_iss/2      [z_rd_iss/2]
root      3078     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_iss/3      [z_rd_iss/3]
root      3079     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_iss/4      [z_rd_iss/4]
root      3080     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_iss/5      [z_rd_iss/5]
root      3081     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_iss/6      [z_rd_iss/6]
root      3082     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_iss/7      [z_rd_iss/7]
root      3083     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_int/0      [z_rd_int/0]
root      3084     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_int/1      [z_rd_int/1]
root      3085     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_int/2      [z_rd_int/2]
root      3086     2  0 Feb22 ?        00:00:00      0       0   0 S z_rd_int/3      [z_rd_int/3]
root      3087     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss/0      [z_wr_iss/0]
root      3088     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss/1      [z_wr_iss/1]
root      3089     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss/2      [z_wr_iss/2]
root      3090     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss/3      [z_wr_iss/3]
root      3091     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss_h/0    [z_wr_iss_h/0]
root      3092     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss_h/1    [z_wr_iss_h/1]
root      3093     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss_h/2    [z_wr_iss_h/2]
root      3094     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss_h/3    [z_wr_iss_h/3]
root      3095     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_iss_h/4    [z_wr_iss_h/4]
root      3096     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/0      [z_wr_int/0]
root      3097     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/1      [z_wr_int/1]
root      3098     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/2      [z_wr_int/2]
root      3099     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/3      [z_wr_int/3]
root      3100     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/4      [z_wr_int/4]
root      3101     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/5      [z_wr_int/5]
root      3102     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/6      [z_wr_int/6]
root      3103     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/7      [z_wr_int/7]
root      3104     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/8      [z_wr_int/8]
root      3105     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/9      [z_wr_int/9]
root      3106     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/10     [z_wr_int/10]
root      3107     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/11     [z_wr_int/11]
root      3108     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/12     [z_wr_int/12]
root      3109     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/13     [z_wr_int/13]
root      3110     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/14     [z_wr_int/14]
root      3111     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int/15     [z_wr_int/15]
root      3112     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int_h/0    [z_wr_int_h/0]
root      3113     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int_h/1    [z_wr_int_h/1]
root      3114     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int_h/2    [z_wr_int_h/2]
root      3115     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int_h/3    [z_wr_int_h/3]
root      3116     2  0 Feb22 ?        00:00:00      0       0   0 S z_wr_int_h/4    [z_wr_int_h/4]
root      3117     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/0      [z_fr_iss/0]
root      3118     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/1      [z_fr_iss/1]
root      3119     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/2      [z_fr_iss/2]
root      3120     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/3      [z_fr_iss/3]
root      3121     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/4      [z_fr_iss/4]
root      3122     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/5      [z_fr_iss/5]
root      3123     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/6      [z_fr_iss/6]
root      3124     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/7      [z_fr_iss/7]
root      3125     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/8      [z_fr_iss/8]
root      3126     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/9      [z_fr_iss/9]
root      3127     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/10     [z_fr_iss/10]
root      3128     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/11     [z_fr_iss/11]
root      3129     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/12     [z_fr_iss/12]
root      3130     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/13     [z_fr_iss/13]
root      3131     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/14     [z_fr_iss/14]
root      3132     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/15     [z_fr_iss/15]
root      3133     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/16     [z_fr_iss/16]
root      3134     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/17     [z_fr_iss/17]
root      3135     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/18     [z_fr_iss/18]
root      3136     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/19     [z_fr_iss/19]
root      3137     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/20     [z_fr_iss/20]
root      3138     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/21     [z_fr_iss/21]
root      3139     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/22     [z_fr_iss/22]
root      3140     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/23     [z_fr_iss/23]
root      3141     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/24     [z_fr_iss/24]
root      3142     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/25     [z_fr_iss/25]
root      3143     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/26     [z_fr_iss/26]
root      3144     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/27     [z_fr_iss/27]
root      3145     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/28     [z_fr_iss/28]
root      3146     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/29     [z_fr_iss/29]
root      3147     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/30     [z_fr_iss/30]
root      3148     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/31     [z_fr_iss/31]
root      3149     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/32     [z_fr_iss/32]
root      3150     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/33     [z_fr_iss/33]
root      3151     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/34     [z_fr_iss/34]
root      3152     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/35     [z_fr_iss/35]
root      3153     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/36     [z_fr_iss/36]
root      3154     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/37     [z_fr_iss/37]
root      3155     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/38     [z_fr_iss/38]
root      3156     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/39     [z_fr_iss/39]
root      3157     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/40     [z_fr_iss/40]
root      3158     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/41     [z_fr_iss/41]
root      3159     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/42     [z_fr_iss/42]
root      3160     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/43     [z_fr_iss/43]
root      3161     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/44     [z_fr_iss/44]
root      3162     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/45     [z_fr_iss/45]
root      3163     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/46     [z_fr_iss/46]
root      3164     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/47     [z_fr_iss/47]
root      3165     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/48     [z_fr_iss/48]
root      3166     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/49     [z_fr_iss/49]
root      3167     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/50     [z_fr_iss/50]
root      3168     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/51     [z_fr_iss/51]
root      3169     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/52     [z_fr_iss/52]
root      3170     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/53     [z_fr_iss/53]
root      3171     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/54     [z_fr_iss/54]
root      3172     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/55     [z_fr_iss/55]
root      3173     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/56     [z_fr_iss/56]
root      3174     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/57     [z_fr_iss/57]
root      3175     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/58     [z_fr_iss/58]
root      3176     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/59     [z_fr_iss/59]
root      3177     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/60     [z_fr_iss/60]
root      3178     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/61     [z_fr_iss/61]
root      3179     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/62     [z_fr_iss/62]
root      3180     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/63     [z_fr_iss/63]
root      3181     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/64     [z_fr_iss/64]
root      3182     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/65     [z_fr_iss/65]
root      3183     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/66     [z_fr_iss/66]
root      3184     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/67     [z_fr_iss/67]
root      3185     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/68     [z_fr_iss/68]
root      3186     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/69     [z_fr_iss/69]
root      3187     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/70     [z_fr_iss/70]
root      3188     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/71     [z_fr_iss/71]
root      3189     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/72     [z_fr_iss/72]
root      3190     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/73     [z_fr_iss/73]
root      3191     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/74     [z_fr_iss/74]
root      3192     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/75     [z_fr_iss/75]
root      3193     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/76     [z_fr_iss/76]
root      3194     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/77     [z_fr_iss/77]
root      3195     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/78     [z_fr_iss/78]
root      3196     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/79     [z_fr_iss/79]
root      3197     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/80     [z_fr_iss/80]
root      3198     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/81     [z_fr_iss/81]
root      3199     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/82     [z_fr_iss/82]
root      3200     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/83     [z_fr_iss/83]
root      3201     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/84     [z_fr_iss/84]
root      3202     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/85     [z_fr_iss/85]
root      3203     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/86     [z_fr_iss/86]
root      3204     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/87     [z_fr_iss/87]
root      3205     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/88     [z_fr_iss/88]
root      3206     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/89     [z_fr_iss/89]
root      3207     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/90     [z_fr_iss/90]
root      3208     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/91     [z_fr_iss/91]
root      3209     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/92     [z_fr_iss/92]
root      3210     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/93     [z_fr_iss/93]
root      3211     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/94     [z_fr_iss/94]
root      3212     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/95     [z_fr_iss/95]
root      3213     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/96     [z_fr_iss/96]
root      3214     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/97     [z_fr_iss/97]
root      3215     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/98     [z_fr_iss/98]
root      3216     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_iss/99     [z_fr_iss/99]
root      3217     2  0 Feb22 ?        00:00:00      0       0   0 S z_fr_int/0      [z_fr_int/0]
root      3218     2  0 Feb22 ?        00:00:00      0       0   0 S z_cl_iss/0      [z_cl_iss/0]
root      3219     2  0 Feb22 ?        00:00:00      0       0   0 S z_cl_int/0      [z_cl_int/0]
root      3220     2  0 Feb22 ?        00:00:00      0       0   0 S z_ioctl_iss/0   [z_ioctl_iss/0]
root      3221     2  0 Feb22 ?        00:00:00      0       0   0 S z_ioctl_int/0   [z_ioctl_int/0]
root      3226     2  0 Feb22 ?        00:00:00      0       0  39 S zfs_iput_taskq/ [zfs_iput_taskq/]
@devsk
Copy link
Author

devsk commented Feb 23, 2011

Nothing ZFS related is active in the system i.e. there is no filesystem. Only a single pool.

@behlendorf
Copy link
Contributor

Yes, I agree the number of threads is crazy but it is the same thread mix as used on Solaris. With new Linux kernels we may be able to fix this by leveraging the new cmwq support. Here's a link for the interested reader.

http://lwn.net/Articles/393171/

@devsk
Copy link
Author

devsk commented Feb 23, 2011

why does ZFS need these many threads anyway? I mean how many CPUs does it expect to run on? And why are they even there when not even a single FS is present in the system?

I am not sure if CMWQ made it into the kernel. We need to check that.

@behlendorf
Copy link
Contributor

For the most part they just use it to maximum concurrency to the pool. There are other ways to go about this of course. But they had some nice existing infrastructure for creating thread pools, and it simplified the code, so I suspect they just used them. I don't think this is something to get hung up on in the short term, all the threads are usually idle and light weight, but I agree it's annoying and we should look at what can/should be done.

@adilger
Copy link
Contributor

adilger commented Sep 16, 2011

There is really only 8kB or so allocated to each thread for the task_struct and the stack, so the actual resource usage is very little (150 threads shown here is only about 1MB of RAM). I think it bothers people more just to see the threads.

I recall it may be possible to "hide" all of the duplicate threads if they are created as "light weight" threads instead of full threads, similar to what multi-threaded programs like java do, and they won't show up in "ps" output unless "-L" is used:

[root@twoshoes ~]# ps -ef | grep rsyslog
root 1157 1 0 Sep12 ? 00:00:10 /sbin/rsyslogd -c 4
[root@twoshoes ~]# ps -eLf | grep rsyslog
root 1157 1 1157 0 5 Sep12 ? 00:00:00 /sbin/rsyslogd -c 4
root 1157 1 1159 0 5 Sep12 ? 00:00:01 /sbin/rsyslogd -c 4
root 1157 1 1160 0 5 Sep12 ? 00:00:02 /sbin/rsyslogd -c 4
root 1157 1 1161 0 5 Sep12 ? 00:00:00 /sbin/rsyslogd -c 4
root 1157 1 27796 0 5 11:19 ? 00:00:00 /sbin/rsyslogd -c 4

This shows that rsyslogd PID 1157 is really made up of 5 lightweight threads (LWP 1157..1161, 27796).

I've been thinking about doing this for the Lustre threads as well, since people complain about the number of threads at times, but it is actually a tempest in a teacup for the amount of memory used vs. the convenience of the programming model. That said, I haven't actually looked at how this might be done within the kernel.

@ckoolkarni
Copy link

Hi,
I am new to ZFS.

I was looking into code and found that the reason behind this is zio_taskqueues.

const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = {
/* ISSUE ISSUE_HIGH INTR INTR_HIGH */
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL },
{ ZTI_FIX(8), ZTI_NULL, ZTI_BATCH, ZTI_NULL },
{ ZTI_BATCH, ZTI_FIX(5), ZTI_FIX(16), ZTI_FIX(5) },
{ ZTI_FIX(100), ZTI_NULL, ZTI_ONE, ZTI_NULL },
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL },
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL },
};

zfs/module/zfs/spa.c

Above output given in
"devsk opened this issue a year ago Too many ZFS related processes/tasks"
clearly matches with the configuration.

I believe as a part of zfs port taskqueues are used on the linux.

I am having one question though, are there any performance implications of using solaris taskqueues in linux environment for current ZFS implementations on linux ?

@behlendorf
Copy link
Contributor

These values are they same as on Solaris, however that doesn't mean they are known to the best values for Linux. It would be interesting to do a performance study on changes certain thread counts to see how it helps/hurts performance.

More generically there has been some performance concern about the spl taskq implementation. However, at this point it's been pretty well tuned and works quite well for most workloads. I suspect there are still some scaling issues which could be improved but in practice they don't start limiting performance until your pushing data at about 3 GB/s. Still we will want to fix that going forward.

@ckoolkarni
Copy link

Thanks Brian for quick reply.

Do you have any specific scenario's which can be tested for performance ?

@behlendorf
Copy link
Contributor

Not specifically, I would suggest you test a workload of interest to you and see if it performs well enough for your needs.

@CMCDragonkai
Copy link

Should the number of ZFS workers/threads be related to the number of processors on the system?

@DeHackEd
Copy link
Contributor

They are. For example right now a writer thread (does compression, etc) is created for 3/4 (75%) of all CPUs. These are naned [z_wr_iss/0]. So people with more cpu cores will tend to have a lot more ZFS processes.

I did a quick check of the kernel source code a while back and it doesn't look like there's an easy way to make kernel threads into a single bundled process. Which is a shame because that would be a nice way to clean up the process list in the short term.

@behlendorf
Copy link
Contributor

I've given this some thought and I think the best solution here is to dynamically create and destroy the taskq threads as needed. They account for the vast majority of ZFS threads on the system. Allowing them to drop to zero when the system is idle and increase to a specified maximum value when needed should work well.

The logic for this in the taskq code doesn't need to be fancy. Since creating and destroying threads under Linux is cheap I'd suggest creating a new thread on demand if there's room for it and there are pending it's for the taskq. When a work item finishes it could destroy the thread if there are no more pending items to process.

@behlendorf behlendorf changed the title Too many ZFS related processes/tasks Reduce ZFS related processes/tasks Oct 3, 2014
@behlendorf behlendorf removed this from the 0.8.0 milestone Oct 3, 2014
@behlendorf
Copy link
Contributor

Resolved by openzfs/spl@f7a973d and aa9af22.

@behlendorf behlendorf added this to the 0.6.5 milestone Jun 25, 2015
richardelling pushed a commit to richardelling/zfs that referenced this issue Oct 15, 2018
Signed-off-by: satbir <satbir.chhikara@gmail.com>
ahrens added a commit to ahrens/zfs that referenced this issue Dec 17, 2019
We get EOVERFLOW (which causes the "Value too large" message) from
zap_entry_read() when trying to read a ZAP entry and the provided buffer
is too small to hold the entire value. In this case we are doing
zap_lookup_impl() in the bookmark zap object (ds_bookmarks_obj).

The dsl_bookmark_phys_t is one word longer on Linux than on (our version
of) illumos. (The additional word is zbm_ivset_guid, used by the
encryption feature.) We aren't creating any bookmarks on linux (before
migration completes), but there are some additional code paths that can
result in updating existing bookmarks to use the new, larger size which
is incompatible with illumos.

Specifically, dsl_bookmark_sync_done() updates bookmarks that are at or
after the most recent snapshot, whenever there's a write to the dataset.
This update increases the size to be incompatible with illumos. Based on
preliminary testing, that seems to be the case we're hitting.
Additionally, when we destroy a snapshot that has bookmarks at or just
before it, we will update those bookmarks via
dsl_bookmark_ds_destroyed().

The solution is to maintain the existing bookmark length when updating
the bookmark's FBN values.

External issue: DLPX-67744
sdimitro pushed a commit to sdimitro/zfs that referenced this issue Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Feature request or new feature
Projects
None yet
Development

No branches or pull requests

6 participants